Practice mode Data Structures

Which traversal of a binary search tree visits the keys in ascending sorted order?

Correct answer D. Inorder

Explanation

Inorder traversal visits the left subtree, then the node, then the right subtree. In a BST every key on the left is smaller and every key on the right is larger, so this order outputs keys from smallest to largest. Preorder and level order start with the root, which is usually not the minimum, and postorder ends with the root.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.