Binary Trees and Traversals - Complexity Analysis

Download Q&A
Q. If a binary tree has a height of h, what is the maximum number of nodes it can have?
  • A. 2^h - 1
  • B. 2^h
  • C. h^2
  • D. h!
Q. In a binary tree, what is the maximum height of a tree with n nodes?
  • A. n
  • B. n/2
  • C. log n
  • D. n-1
Q. In a complete binary tree, what is the relationship between the number of nodes and the height of the tree?
  • A. Nodes = 2^height
  • B. Nodes = 2^(height + 1) - 1
  • C. Nodes = height^2
  • D. Nodes = height!
Q. What is the average time complexity of inserting a node in a balanced binary search tree?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the time complexity of deleting a node from a binary search tree in the average case?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the time complexity of post-order traversal of a binary tree?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the time complexity of searching for a value in a binary search tree (BST) with n nodes?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the time complexity of traversing a binary tree using in-order traversal?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. What is the worst-case time complexity for inserting a node in a binary search tree?
  • A. O(n)
  • B. O(log n)
  • C. O(n log n)
  • D. O(1)
Q. Which of the following traversal methods uses a queue data structure?
  • A. In-order
  • B. Pre-order
  • C. Post-order
  • D. Level-order
Q. Which traversal method is not suitable for binary search trees when you want to retrieve nodes in sorted order?
  • A. In-order
  • B. Pre-order
  • C. Post-order
  • D. Level-order
Q. Which traversal method of a binary tree can be used to retrieve nodes in non-decreasing order?
  • A. Pre-order
  • B. Post-order
  • C. In-order
  • D. Level-order
Showing 1 to 12 of 12 (1 Pages)
Soulshift Feedback ×

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

Not likely Very likely