At ine 145 and 146 fastdiameter is afunction of class pair and p is an onject

at ine 145 and 146 fastdiameter is afunction of class pair and p is an onject

@Aditya-Kushwaha-914550392281281 hi bro ,woh p jo hai woh pair class ka object hai ,as we want two things in object,also woh fast diameter ek normal function hai jo hm C++ me lete hai.

fast diameter iss functio ka datatype hai userdefined datatype pair

and int main mai pair p object fastdiameter (root ) ko call krrahai . amy saying this thing first time in code till today

aur ek saath hum do class ke datamemeberkom use kr skte jai kya

@Aditya-Kushwaha-914550392281281 basically dekho isme ho kya rha hai ki jo hmara diameter wala function hai uska return type pair class ka object hai ,so hm jaise hi function ko call krrhe hai woh hme retrun krrha hai ek pair ka object jisme do cheezein hai ,ab hme use khi store krana hoga islie hmne pair class ka object bna lia aur usme store kra lia ,pair class hjmne two things ko ek sath store krane ke lie bnayi just ,aur hmara function normal c++ wla function hai ,just jo main ke bhar bnta hai
Also hm ek sath do class ke member ko acees kr skte hai but hme dono class ke object bnane pdenge and uske through member ko acess krna pdega,dont get confuse with oops ,just upr wali explanation pdho you will get it.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

please xplainn line 152 and 153

It is just doing the recursive call to get the pair value of the left subtree and the pair value of the right subtree. Pair contains the height and diameter value of a subtree. For computing the height and diameter at a particular node, we must know the height and diameter value at its left child and right child( as explained by Prateek Bhaiya in the video while deriving the recursive relation) so we are doing those recursive calls.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.