Inorder Successor in a binary search tree

preview_player
Показать описание
See complete series on data structures here:

In this lesson, we have discussed efficient algorithm to find Inorder successor of a Node in binary search tree.

See source code here:

See video on Inorder Traversal here:

Рекомендации по теме
Комментарии
Автор

This entire playlist is a treasure. Downloaded all the videos and created multiple copies in my PC, my external hard drive and google drive. Cannot risk it losing in case of apocalypse. And whoever you are, a big thank you. You are a GOAT.

DhirendraSingh
Автор

It’s been 10 YEARS since this playlist and people are still watching it, I don’t usually comment but Really Thank you for this masterpiece

llarn.i
Автор

After 2 Years...THis videos Helped the am sure till many years this videos will keep helping Students

deeepbagadiya
Автор

I am a beginner in DS. These videos helped me a lot to understand quickly. Thanks a lot. Please don't stop uploading. Keep going.

darshanbhat
Автор

mycodeschool Your tutorials are BRILLIANT! Please do continue the series as soon as possible. Would like to see more on Trees, Graphs, Maps, Hash-tables etc.

shelbygt
Автор

finally i find someone who explain all things with details thank you so much

RAFAHOUSSAM
Автор

Hi Sir, I have followed all your BST tutorials. It was very great and clear explanation. Initially I was afraid of learning BST. Now I can say I have learned BST confidently from your explanation. Thank you very much your contribution to helping programmers.

narayankaadda
Автор

I'm watching this series after my engineering, these data structures make much more sense now thank you so much

prudvi
Автор

Yooo, this whole concept of BST is freaking amazing, almost magical. Thanks a lot for sharing this mate!

Leon-hgph
Автор

I'm in tear watching your video sir, the way you spreading knowledge is on god tier, I coundn't been more satisfied with my life without learning from you.Much Love!

scotfsh
Автор

this play list is absolute bonus for every programmer who wants to get good at data structure, Many thanks to CS DOJO for suggesting this

Drogon-Gaming
Автор

I'm gonna hit Like 👍🏻to every video of this channel coz It Deserves !!

AnonymousCoder
Автор

finally completed the whole DS series :)

gouravgg
Автор

All videos are great, most important thing is that they are all very interactive and you have worked very hard in making them and teaching us.
Thankyou

darshpreetsingh
Автор

This is THE PERFECT explanation of this concept.

sarveshp
Автор

Hi I'm Kapil,
These codes for successor and predecessor seem to work fine. They keep on storing the pointer to nodes whose value is greater than (or less than) the given integer in the path of search for the integer and the latest updated value is our answer.
And also when it finds the integer, it doesn't stop, it goes on to find the next greater value (or smaller) by traversing further down the tree. It's a tiny code :)

TreeNode* getSuccessor(TreeNode* A, int B) {
TreeNode *P=NULL;
while(A!=NULL)
{
if(A->val<=B)
{
A=A->right;
}
else if(A->val>B)
{
P=A;
A=A->left;
}
}
return P;

TreeNode* getPredecessor(TreeNode* A, int B) {
TreeNode *P=NULL;
while(A!=NULL)
{
if(A->val<B)
{
P=A;
A=A->right;
}
else if(A->val>=B)
{
A=A->left;
}
}
return P;

yuiooiuyyuiooiuyyuio
Автор

You haven't handled the case when current node is leaf node. Yet, still it is an excellent tutorial for DS and I will recommend this to other. I have learnt a lot from you. Thank you so much..

chayakumarsedutainment
Автор

In Getsuccessor function instead of:
"if(current->data < ancestor->data)" we must use :if(current->data <= ancestor->data)"
To ensure the data less or equal will be found in left subtree.
Thanks for sharing your knowledge.

sarveshsant
Автор

Really, great stuff man. You have helped a lot of people. You should be really proud of yourself.

shubhammohapatra
Автор

Man...U are an inspiration for me.. You are just great.. No words can express your work.. Thanx for helping

parthkhanna