Question
Consider a Binary Search Tree (BST) with the following
values inserted in sequence: 45, 32, 50, 15, 40, 47, 60. What will be the in-order traversal of this BST after all insertions?Solution
In-order traversal of a BST processes nodes in an ascending order because it visits the left subtree first, then the root, and finally the right subtree. After inserting the values in the specified order into the BST, performing an in-order traversal yields the nodes in the correct ascending order: 15, 32, 40, 45, 47, 50, 60. The traversal algorithm guarantees that every nodeтАЩs left subtree is smaller, and the right subtree is larger, which ensures a sorted sequence. Why other options are wrong: B) This is the reverse order of an in-order traversal, visiting the largest element first. C) This option shows a pre-order traversal, which visits the root node first before the subtrees. D) This sequence incorrectly mixes elements from the left and right subtrees, violating the order property. E) This option represents a reverse post-order traversal, starting with the deepest right-side elements.
рд╡рд░реНрддрдиреА рдХреА рджреГрд╖реНрдЯрд┐ рд╕реЗ рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рдХреМрди - рд╕рд╛ рд╢рдмреНрдж рдЕрд╢реБрджреНя┐╜...
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдпреБрдЧреНрдо-рд╢рдмреНрджреЛрдВ рдХрд╛ рдЕрд░реНрде рд▓рд┐рдЦрд┐рдПред┬а
рдЕрдкреЗрдХреНрд╖рд╛- рдЙрдкреЗрдХреНрд╖рд╛
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рд╕реЗ рдХреМрди рд╕рд╛ рд╢рдмреНрдж рд╕реНрддреНрд░реАрд▓рд┐рдВрдЧ рд╣реИ ?
'рдкрдВрдЪрд╛рдореГрдд ' рдореЗрдВ рдХреМрди-рд╕рд╛ рд╕рдорд╛рд╕ рд╣реИ ?
' рдлрд▓ ' рд╢рдмреНрдж рдХрд╛ рдЕрдиреЗрдХрд╛рд░реНрдереА рдирд╣реАрдВ рд╣реИрдВ ?
' рджреБрд░реНрдЬрдп ' рд╢рдмреНрдж рдореЗрдВ рдкреНрд░рдпреБрдХреНрдд рдЙрдкрд╕рд░реНрдЧ рдХреНрдпрд╛ рд╣реИ ?┬а
рдЬреЛ рдмрд╣реБрдд рдмреЛрд▓рддрд╛ рд╣реЛ┬а┬а
рдХрд┐рд╕ рдХреНрд░рдорд╛рдВрдХ рдореЗрдВ тАШрдкрд░рд┐рдорд╛рдг тАУ рдкрд░рд┐рдгрд╛рдотАЩ рд╢рдмреНрджрд░ рдпреБрдЧреНрдорд╛ рдХрд╛ рд╕рд╣реА рдЕрд░реНя┐╜...
рдЬрд┐рд╕реЗ рд╣рд░рд╛рдпрд╛ рди рдЬрд╛ рд╕рдХреЗ┬а
рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдореЗрдВ рдЕрд╢реБрджреНрдз рд╢рдмреНрдж рд╣реИ