Complete the sentence to explain why BSTs are efficient for searching.
A Binary Search Tree (BST) allows searching in [1] time on average.
The average time complexity for searching in a BST is logarithmic because each comparison allows the search to skip about half of the remaining tree.
Complete the sentence to describe the BST property that helps efficient searching.
In a BST, for any node, all values in the left subtree are [1] the node's value.
The BST property states that all values in the left subtree are less than the node's value, which helps decide which subtree to search next.
Fix the error in the explanation about BST search efficiency.
BST search is efficient because it [1] the search space by half at each step.At each step, BST search reduces the search space by half, making it efficient.
Fill both blanks to complete the BST search explanation.
At each node, the search compares the target value with the node's value and then [1] to the [2] subtree if the target is smaller.
The search moves to the left subtree if the target value is smaller than the current node's value.
Fill all three blanks to complete the dictionary comprehension that represents BST search steps.
search_path = [1]: node for node in bst_nodes if node.value [2] target_value [3]
This comprehension collects nodes with values less than or equal to the target, representing the search path in a BST.