Which of the following real-world scenarios would be well-suited for using a Segment Tree data structure?
All of the above.
Storing and querying historical stock prices for a particular company.
Finding the shortest path between two nodes in a weighted graph.
Implementing an undo/redo functionality in a text editor.
What is the worst-case time complexity for searching for a specific value in a perfectly balanced BST?
O(1)
O(log n)
O(n log n)
O(n)
Which of the following is NOT a type of self-balancing BST?
AVL Tree
B-Tree
Binary Heap
Red-Black Tree
What is the primary advantage of using a Complete Binary Tree for implementing a Heap data structure?
It minimizes the space used for storing the tree.
It guarantees a balanced tree, ensuring O(log n) operations.
It simplifies the process of tree rotations.
It allows for efficient searching of elements in O(1) time.
Consider a Segment Tree designed to handle range sum queries. An update operation is performed on a single element of the original array. How many nodes in the Segment Tree, on average, need to be updated to reflect this change?
O(√n)
What is the key invariant property of a Binary Search Tree (BST) that differentiates it from a regular Binary Tree?
The left subtree of a node contains only values less than the node's value, and the right subtree contains only values greater than the node's value.
The tree is always complete.
Every node has at most two children.
The height of the tree is always balanced.
What is the time complexity of the most efficient algorithm to convert a sorted array to a balanced Binary Search Tree?
Consider a Binary Search Tree (BST). What is the time complexity of finding the LCA of two nodes in the BEST-CASE scenario?
In a Perfect Binary Tree with height 'h', what is the maximum number of nodes it can have?
2h + 1
2^h - 1
h^2
2^(h+1) - 1
In a Threaded Binary Tree, what is the primary purpose of threading?
To enable more efficient searching algorithms.
To simplify the insertion and deletion of nodes.
To reduce the space complexity of storing the tree structure.
To allow traversal of the tree without recursion or stacks.