Inorder traversal of a tree will result in a sorted list in case of?
Thursday, January 26, 2023
Add Comment
Question: Inorder traversal of a tree will result in a sorted list in case of?
Yes, in-order traversal of a binary search tree will result in a sorted list. This is because a binary search tree is a special type of binary tree where all the left subtree nodes contain values that are smaller than the parent node, and all the right subtree nodes have value that are greater than the parent node. As we traverse the tree in-order (i.e. leftnode->root->rightnode), we will visit the nodes in an increasing order. As a result, the result of the in-order traversal will be a sorted list.
0 Komentar
Post a Comment