I had thought I understood BSTs. That was until my Professor came along.
Let's say I have a BST:
2
/ \
1 3
Now if I were to insert 4, my tree would look like this:
2
/ \
1 3
\
4
but my Professor's tree would end up like this:
2
/ \
1 4
/ \
3 4
Basically, he finds where the new node should be placed and places it there. He then changes the value of the new node's parent to the new node's value and makes the left child of the parent what the original parent node used to be.
I have looked around online but can't find anyone doing this.
What kind of insertion technique is this? Am I missing something? I don't think it would make a difference but this was specifically for AVL trees.