Binary Trees and Traversals - Implementations in C++ - Advanced Concepts

Download Q&A
Q. How do you determine the height of a binary tree?
  • A. Count the number of nodes
  • B. Count the number of edges
  • C. Maximum depth of any node
  • D. Minimum depth of any node
Q. In a binary tree, what does the term 'height' refer to?
  • A. Number of nodes
  • B. Number of edges
  • C. Maximum depth of a node
  • D. Minimum depth of a node
Q. What is the postorder traversal sequence of a binary tree with root A, left child B, and right child C?
  • A. A B C
  • B. B A C
  • C. B C A
  • D. C B A
Q. What is the primary purpose of a binary tree's inorder traversal?
  • A. To delete nodes
  • B. To find the height
  • C. To sort the elements
  • D. To count nodes
Q. What is the primary use of a queue in tree traversal?
  • A. To store nodes for depth-first search
  • B. To store nodes for breadth-first search
  • C. To store nodes for sorting
  • D. To store nodes for searching
Q. What is the result of a postorder traversal on a binary tree?
  • A. Root, Left, Right
  • B. Left, Right, Root
  • C. Right, Left, Root
  • D. Left, Root, Right
Q. What is the space complexity of recursive tree traversals?
  • A. O(n)
  • B. O(log n)
  • C. O(1)
  • D. O(n log n)
Q. Which of the following is a valid way to implement a binary tree in C++?
  • A. Using an array
  • B. Using a linked list
  • C. Using a struct
  • D. All of the above
Q. Which of the following is true about a binary search tree (BST)?
  • A. Inorder traversal gives sorted order
  • B. Preorder traversal gives sorted order
  • C. Postorder traversal gives sorted order
  • D. Level order traversal gives sorted order
Q. Which traversal method is not suitable for binary search trees when you want to delete nodes?
  • A. Inorder
  • B. Preorder
  • C. Postorder
  • D. Level order
Q. Which traversal method uses a stack to keep track of nodes?
  • A. Inorder
  • B. Postorder
  • C. Level order
  • D. Preorder
Showing 1 to 11 of 11 (1 Pages)
Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely