COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Start at the rootIf the item is less than the root-add to the leftIf the item is more than the root-add to the right
|
|
Start at the rootIf the item is less than the root-add to the rightIf the item is more than the root-add to the left
|
|
Start at the bottomIf the item is less than the root-add to the leftIf the item is more than the root-add to the rightEnd at the root
|
|
Start at the bottomIf the item is less than the root-add to the rightIf the item is more than the root-add to the leftEnd at the root
|
Detailed explanation-1: -An inorder traversal first visits the left child (including its entire subtree), then visits the node, and finally visits the right child (including its entire subtree). The binary search tree makes use of this traversal to print all nodes in ascending order of value.
Detailed explanation-2: -So the classification of traversal is based on the order in which root is visited: 1) First visit root node, then traverse left or right subtree 2) First traverse either left or right subtree, then visit root node 3) First traverse left and right subtree, then visit root in the last.
Detailed explanation-3: -Whenever an element is to be inserted, first locate its proper location. Start searching from the root node, then if the data is less than the key value, search for the empty location in the left subtree and insert the data. Otherwise, search for the empty location in the right subtree and insert the data.