Suppose you are given a balanced binary search tree with 15 nodes in it, containing the even numbers from 2 to 30 inclusive.
(a) (5 points) Draw this tree.
(b) (3 points) Explain how you would check if the number 18 is in this
tree, and state the number of operations this would take.
(c) (2 points) Explain how you would insert the number 27 into this tree,
and state the number of operations this should take.

b).1st operation :- 18 will be compared with root.if it is equal it return yes.but 18 is not equal to 16 so,2nd operation is performed.
2nd operation:- If 18 is not equal to root(which is the case here) then it checks whether 18 is greater or smaller than root.clearly,it is greater than 16 so,it moves to right child of root.
3rd operation:- it is same as 1st operation except for the fact that the root is now right child i.e 24.
4th operation:-Same as 2nd operation but here 18 is smaller than 24 so,it moves to the left child of current root i.e 24.
5th operation:-same as 1st operation except here root is 20.
6th operation:- same as 2nd operation but here 18 is smaller than 20,so,search proceeds on left child of 20.
7th operation:-same as 1st operation but here 18 is actually equal to 18 so it return yes.
c).To insert any data into Balanced BST follow this procedure:-
i).First find the correct place for the node in balanced BST.this step takes O(logn) time.
ii).now,attach the node to its correct place.
iii).Check if the tree is balanced or not?if it not then perform appropriate rotations.

Suppose you are given a balanced binary search tree with 15 nodes in it, containing the even numb...
(20 points) Suppose you are given a binary search tree T of n nodes (as discussed in class. each node v has v.left, v.right, and v.key). We assume that no two keys in T are equal. Given a value x, the rank operation rank() is to return the rank of x in T, which is defined to be one plus the number of keys of T smaller than 2. For example, if T has 3 keys smaller than r, then...
Show that the tree height of a height-balanced binary search tree with n nodes is O(log n). (Hint: Let T(h) denote the fewest number of nodes that a height-balanced binary search tree of height h can have. Express T(h) in terms of T(h-1) and T(h-2). Then, find a lower bound of T(h) in terms of T(h-2). Finally, express the lower bound of T(h) in terms of h.)
1 Binary Search Trees (25 points) Consider the binary tree as shown in Figure 1. 9 5 15 10 17 8 Figure 1: Binary Tree: The letter next to each node (e.g., a, b) denotes the tree node, and the number inside each node is the key. 1.1 Correctness (10 points) Is this binary tree a valid binary search tree? In other words, does it satisfy the binary search tree property? If not, which node(s) violates the binary search tree...
In general, assuming a balanced BST with n nodes (A balanced binary tree has roughly the same number of nodes in the left and right subtrees of the root), what is the maximum number of operations required to search for a key? Please notice that the tree in this exercise is not balanced. Trace the algorithm for creating a parse tree for the expression (((4 x 8)/6)–3 Please help me understand :(
C++ ONLY Threaded Binary Search Tree Since a binary search tree with N nodes has N + 1 NULL pointers, half the space allocated in a binary search tree for pointer information is wasted. Suppose that if a node has a NULL left child, we make its left child pointer link to its inorder predecessor, and if a node has a NULL right child, we make its right child pointer link to its inorder successor. This is known as a...
Suppose a binary search tree has multiple nodes containing the same key value, k. Let node p be the lowest common ancestor of such nodes. Then, the key of p must be also k. If this is true, provide an argument. Otherwise, provide a counterexample.
IN JAVA create a binary search tree gui where you can insert and remove nodes, also move around the tree, thank you. The simpler the better.
IN JAVA create a binary search tree gui where you can insert and remove nodes, also move around the tree, thank you. The simpler the better.
I need question 9-10 answered. Thank you
Question 1 iShow the resulting binary search tree if we are to insert following elements into the tree in given order, [34, 12, 23, 27,31,9,11,45, 20, 37. i) Show the resulting balanced binary search tree if we are to insert following sorted elements into the tree, [9,12,21, 23, 29, 31, 34, 45, 48, 52, 55] iii What is the pre-order traversal of the balanced binary search tree? v) What is the post-order traversal...
Trees and Heaps 1. Show that the maximum number of nodes in a binary tree of height h is 2h+1 − 1. 2. A full node is a node with two children. Prove that the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree. 3. What is the minimum number of nodes in an AVL tree of height 15? 4. Show the result of inserting 14, 12, 18, 20, 27, 16,...