Find a pair with given sum in BST | GeeksforGeeks

preview_player
Показать описание


This video is contributed by Anant Patni

Please Like, Comment and Share the Video among your friends.

Install our Android App:

If you wish, translate into local language and help us reach millions of other geeks:

Follow us on Facebook:

And Twitter:

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

i just have a doubt, why we put second if for left call, why not the same as for the right call(return)

harshitparashar
Автор

We can also do this with time complexity O(n) using a hashmap, yes?

SuryaTripathi
Автор

can we use preorder traversal for above solution .please can anyone reply to me??

hemanthn
Автор

Input:
14 5 15 3 11 N N 2 4 10 13
7

Its Correct output is:
1


For this test case, we have the sum for 7 for two cases 5+2 as well as 4+3. why is the solution mentioning as 1. Am I missing any case?

bandarurakesh
Автор

Hi team, I have started watching all the videos regularly, could you please slow down the explanation I could not understand the scope of the third if statement..
Thanks..

barathnatarajan