Binary Search Tree
Binary Search Tree
#include <stdio.h>
#include <stdlib.h>
struct node {
int key;
struct node *left, *right;
};
// Driver Code
int main()
{
/* Let us create following BST
50
/ \
30 70
/\/\
20 40 60 80 */
struct node* root = NULL;
root = insert(root, 50);
insert(root, 30);
insert(root, 20);
insert(root, 40);
insert(root, 70);
insert(root, 60);
insert(root, 80);
return 0;
}
struct Node {
int key;
struct Node *left, *right;
};
// Find successor
struct Node* succ = root->right;
while (succ->left != NULL) {
succParent = succ;
succ = succ->left;
}
return 0;
}