Suppose that we have numbers between 1 and 1000 in a binary search tree and we want to search for the number 365. Which of the following sequences could not be the sequence of nodes examined ?
927, 204,913, 242, 914, 247, 365
In a BST search, at each node we go left if the key is smaller and right if it is larger. Every step therefore narrows an interval (low, high) of allowed values, and every later node must lie inside the current open interval.
4, 254, 403, 400, 332, 346, 399, 365: the interval becomes (4, ∞), (254, ∞), (254, 403), (254, 400), (332, 400), (346, 400), (346, 399); every node fits, so this path is possible.
926, 222, 913, 246, 900, 260, 364, 365: the interval becomes (−∞, 926), (222, 926), (222, 913), (246, 913), (246, 900), (260, 900), (364, 900); every node fits, so this path is possible.
4, 401, 389, 221, 268, 384, 383, 280, 365: the interval becomes (4, ∞), (4, 401), (4, 389), (221, 389), (268, 389), (268, 384), (268, 383), (280, 383); every node fits, so this path is possible.
927, 204,913, 242, 914, 247, 365: at 913 we move left because 365 \(\lt\) 913, so every later node must be smaller than 913. After 242 the interval is (242, 913), yet the next node is 914 \(\gt\) 913. This violates the BST property, so this sequence cannot occur.
Hence, the answer is 927, 204,913, 242, 914, 247, 365.
Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the number 364. Which of the following sequences could not be the sequence of nodes examined ?
In a ____the left and right subtrees for any given node, differ in height by more than one.
Which of the following description(s) is/are true:
A. Red Black Tree - Guarantees worst case of O(log n) time for search, insert & delete.
B. Trie - Used for efficient prefix - based searches.
C. AVL Tree - self balancing binary search tree with looser balance criteria than a Red Black Tree.
D. B- Tree - Allows efficient search, inert, delete operations in disk based system.
Choose the correct answer from the options given below:
__________ is a Self Balancing binary search tree, where the path from the root to the furthest leaf is no more than twice as long as the path from the root to nearest leaf.
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the number 364. Which of the following sequences could not be the sequence of nodes examined ?
In a ____the left and right subtrees for any given node, differ in height by more than one.
Which of the following description(s) is/are true:
A. Red Black Tree - Guarantees worst case of O(log n) time for search, insert & delete.
B. Trie - Used for efficient prefix - based searches.
C. AVL Tree - self balancing binary search tree with looser balance criteria than a Red Black Tree.
D. B- Tree - Allows efficient search, inert, delete operations in disk based system.
Choose the correct answer from the options given below:
__________ is a Self Balancing binary search tree, where the path from the root to the furthest leaf is no more than twice as long as the path from the root to nearest leaf.