please check it ->https://ide.codingblocks.com/s/469051
Sir, what the mistake am i doing?
hello @chandreshmaurya
after the array manipulation the array b will not be sorted hence u cant use the method that u r using to construct the tree
sir, kya arrey b, modified bst ka inorder sequence hoga? because maine print kr ke dekha to array b, modified bst ka inorder sequence aaya
mai bol raha tah ki array b sorted nahi hai.
aur tum jo tree construction method use kar rahe ho wo sorted array pe valid hota hai.
baaki ye kaam isiliye karega kyunki original array sorted thi
check now->
sir, i have need of approach for this question.
refer this->
We can do it using a single traversal. The idea is to use following BST property. If we do reverse Inorder traversal of BST, we get all nodes in decreasing order. We do reverse Inorder traversal and keep track of the sum of all nodes visited so far, we add this sum to every node.
sir, please isse ek bar dekhiye… mera whi code sare test case ke liye pass ho gya. code -> https://ide.codingblocks.com/s/469097
bro ye to pehle hi bol raha tha , mera previous reply padho,usme already tumhara updated code attach kiya hua hai
ooh sir sorry, aapne comment nhi kiya tha na, isliye uspe meri nzar nhi padi. Thank you sir, Now it’s cleared.
But, sir ye method shi hai na ?
…
ha is question ke lie kaam karega.
oohkay sir, Thank you
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.