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

  • google app store apple app store
  • βœ–

      Question

      What is a 'Binary Search Tree' (BST) and what is its key

      property?
      A A tree where every node has exactly two children and all levels are completely filled Correct Answer Incorrect Answer
      B A binary tree where for each node, all values in the left subtree are less than the node's value, and all values in the right subtree are greater Correct Answer Incorrect Answer
      C A binary tree structure used exclusively for storing sorted arrays where a sorted array can be accessed through inorder traversal of the binary tree Correct Answer Incorrect Answer
      D A balanced tree that guarantees O(log n) operations in all cases Correct Answer Incorrect Answer
      E A tree where the root always contains the maximum value and the subtrees also follow the same rule Correct Answer Incorrect Answer

      Solution

      BST enables efficient search, insertion, and deletion in O(log n) average time through binary search (eliminating half the tree at each step). In-order traversal (Left-Root-Right) yields sorted data. Worst case O(n) for skewed trees (all nodes on one side). Balanced BSTs (AVL tree, Red-Black tree) guarantee O(log n) worst case. They are used in database indexing, symbol tables, and implementing sorted containers (C++ std::map, Java TreeMap).

      Practice Next

      Relevant for Exams:

      ask-question