πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      A data analysis application needs to quickly find the

      minimum or maximum value in a dynamically changing dataset. While a min/max heap could be used, how would a BST perform this task?
      A By traversing the entire tree (O(n)) Correct Answer Incorrect Answer
      B By accessing the root node (O(1)) Correct Answer Incorrect Answer
      C By traversing only the left-most path for minimum (O(h)) or right-most path for maximum (O(h)) Correct Answer Incorrect Answer
      D By performing a level-order traversal Correct Answer Incorrect Answer
      E By using a hash function Correct Answer Incorrect Answer

      Solution

      In a BST, the minimum element is the leftmost node, and the maximum element is the rightmost node. Finding them involves traversing a path from the root, which takes O(h) time, where 'h' is the height of the tree.

      Practice Next
      ask-question