Skills101
← All practice quizzes

Binary Trees & BST Quiz

8 questions12 minPass: 60%+10 XP on first pass

Traversals, DFS vs BFS, height, diameter, LCA and validating a BST.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    For this tree, what is the INORDER traversal? (type the values separated by spaces)

            1
           / \
          2   3
         / \
        4   5
    
  2. Question 2

    For the same tree, what is the PREORDER traversal?

  3. Question 3

    What is the maximum depth (counting nodes) of that tree?

  4. Question 4

    Which traversal of a Binary Search Tree visits values in sorted order?

  5. Question 5

    Which data structure does level-order (BFS) traversal use?

  6. Question 6

    Why is checking only left.val < node.val < right.val NOT enough to validate a BST?

  7. Question 7Select all that apply

    Which tree questions are usually solved with DFS returning a value from the children (postorder)? (select all that apply)

  8. Question 8

    What is the time complexity of visiting every node of a binary tree with n nodes?