“Create a binary search tree from the insertion order 50, 30, 70, 20, 40, 60, 80 and 10, with 50 as the root and every smaller value on the left branch.”
Entenda as decisões por trás dele.
Start the tree at 50.
Put smaller values left and larger values right.
Keep the given sequence when placing nodes.
Use this example when teaching or checking basic BST insertion.
Dúvidas comuns
What makes this a binary search tree?
Each node has values smaller on the left and larger on the right.
Why does insertion order matter?
The same values can make different valid tree shapes in different orders.
Can a BST have duplicates?
It can if the implementation defines where equal values go or stores a count.