i have write down 2 code only single differnce in them braught change in whole code one is printing the right side view anoter all node please expalin me these code differce as i just put * to max variable in other code but i am not able to understand how * is working please bhaiya ache se smjana mje pointer * ka smj ni aa ra
Https://ide.codingblocks.com/s/229420
@kailash_01
There is difference between max and *max. First one is call by value and second is call by reference. Matlab first case me hum jab hum max ko function me pass krenge to max ki ek copy bnegi or uspe changes honge. par second case me hum max ka address pass kar rhe hai matlab max variable pe jaha jo bhi change honge wo humesha same rhenge.
To *max wale case me right view isliye print ho rha hai kyuki max starting me 0 hai or level 1, next recursive call me max 1 ho jayega , 3rd recursive call me 2 and so on. jab backtracks hoga to max ki value highest level wali hi rhegi to koi or same level ka element print nhi hoga.
But max wale case me jab humara program backtrack krega to max is value bhi kam hoti rhegi, or next level pe jane ke baad level> max hoga har baar and sare node ki value print ho jayegi.
Read about call by value and call by reference.
thanku so much !!! 