AVL tree is binary find tree with extr property that difference between height the left sub-tree and also right sub-tree of any type of node can not be much more than 1. Here are some crucial points about AVL trees:If there room n nodes in AVL tree, minimum height of AVL tree is floor(log2n).If there room n nodes in AVL tree, maximum elevation can’t exceed 1.44*log2n.If elevation of AVL tree is h, maximum variety of nodes can be 2h+1 – 1.Minimum variety of nodes in a tree with elevation h have the right to be stood for as:N(h) = N(h-1) + N(h-2) + 1 because that n>2 whereby N(0) = 1 and N(1) = 2.The complexity of searching, inserting and also deletion in AVL tree is O(log n).We have actually discussed types of questions based upon AVL trees.Type 1: relationship between variety of nodes and height the AVL tree –Given variety of nodes, the question deserve to be request to discover minimum and also maximum elevation of AVL tree. Also, offered the height, maximum or minimum variety of nodes deserve to be asked.Que – 1.
You are watching: Minimum number of nodes in avl tree whose height is h
What is the maximum height of any AVL-tree v 7 nodes? Assume the the height of a tree v a solitary node is 0.(A) 2(B) 3(C) 4(D) 5Solution: for finding preferably height, the nodes have to be minimum at each level. Assumingheight as 2, minimum variety of nodes required:N(h) = N(h-1) + N(h-2) + 1N(2) = N(1) + N(0) + 1 = 2 + 1 + 1 = 4.It means, height 2 is completed using minimum 4 nodes.
Assuming elevation as 3, minimum number of nodes required:N(h) = N(h-1) + N(h-2) + 1N(3) = N(2) + N(1) + 1 = 4 + 2 + 1 = 7.It means, elevation 3 is completed using minimum 7 nodes.Therefore, utilizing 7 nodes, us can attain maximum height as 3. Following is the AVL tree with 7 nodes and also height 3.Que – 2. What is the worst case possible height the AVL tree?(A) 2*logn(B) 1.44*log n(C) counts upon implementation(D) θ(n)Solution: The worst case possible height the AVL tree with n nodes is 1.44*logn. This deserve to be confirmed using AVL tree having actually 7 nodes and maximum height.Checking for choice (A), 2*log7 = 5.6, yet height that tree is 3.Checking for alternative (B), 1.44*log7 = 4, which is near to 3.Checking for option (D), n = 7, yet height the tree is 3.Out of these, alternative (B) is the best feasible answer.Type 2: based upon complexity the insertion, deletion and also searching in AVL tree –Que – 3. i beg your pardon of the complying with is TRUE?(A) The expense of looking an AVL tree is θ(log n) however that the a binary find tree is O(n)(B) The price of browsing an AVL tree is θ(log n) yet that that a complete binary tree is θ(n log n)(C) The price of looking a binary find tree is O(log n ) but that of an AVL tree is θ(n)(D) The price of looking an AVL tree is θ(n log n) yet that that a binary find tree is O(n)
Solution: AVL tree’s time intricacy of searching, insertion and deletion = O(logn). Yet a binary search tree, may be it was crooked tree, so in worst situation BST searching, insertion and deletion intricacy = O(n).Que – 4. The worst instance running time to search for an facet in a well balanced in a binary search tree through n*2^n aspects isSolution: Time taken to search an facet is Θ(logn) wherein n is number of elements in AVL tree.As number of elements offered is n*2^n, the searching complexity will it is in Θ(log(n*2^n)) which deserve to be written as:= Θ(log(n*2^n))= Θ(log(n)) + Θ(log(2^n))= Θ(log(n)) + Θ(nlog(2))= Θ(log(n)) + Θ(n)As logn is asymptotically smaller sized than n, Θ(log(n)) + Θ(n) have the right to be written as Θ(n) i beg your pardon matches alternative C.Type 3: Insertion and also Deletion in AVL tree –The question can be asked on the resultant tree when keys are put or turned off from AVL tree. Ideal rotations need to be do if balance element is disturbed.Que – 5.
See more: What Does The Root Word Cardio Mean Ing, Is Cardi A Root Word
take into consideration the complying with AVL tree.Which of the following is updated AVL tree after insertion that 70?(A)(B)(C)