Henry R
- 25
- 0
Draw a Binary Search Trees (BST) produced when data containing 30,40,50,60,10,20,55,15 is inserted one by one.
Thanks.
Thanks.
The discussion focuses on constructing a Binary Search Tree (BST) using the data set 30, 40, 50, 60, 10, 20, 55, and 15. The root of the tree is established as 30, with subsequent nodes placed according to BST properties: nodes in the right subtree are greater than the current node, while those in the left subtree are smaller. The correct insertion order is crucial for maintaining the BST structure, ensuring that each node is positioned accurately based on its value.
PREREQUISITESComputer science students, software developers, and anyone interested in data structure optimization and algorithm design will benefit from this discussion.
Henry R said:Draw a Binary Search Trees (BST) produced when data containing 30,40,50,60,10,20,55,15 is inserted one by one.
Thanks.
evinda said:Note that every node on the right subtree has to be larger than the current node and every node on the left subtree has to be smaller than the current node.
Henry R said:This is ...View attachment 3676
evinda said:Since the data is inserted one by one, $30$ has to be the root.
$40$ is greater than $30$, so it has to be at the right subtree.
So, at the beginning it should be like that:
https://www.physicsforums.com/attachments/3677Can you continue? (Thinking)
Bacterius said:How is 55 smaller than 40?