php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AVL tree, It must satisfie the 2 conditions.
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
AVL tree, It must satisfie the 2 conditions. I got the first one but I have problem in the 2nd condition. Can you explain in detail with examples?

.
For a tree to be an AVL, there are two conditions:
1) It must be a BST
2) For every node, height of left subtree and right subtree can differ by at most 1. In otherwords, balance factor of every node must be 0, 1 or -1. Balance factor = (height of left subtree) - (height of right subtree).

If during insertion, some node doesn't satisfy 2nd condition, then we have to rotate it and there are 4 cases of rotation.
Case I: If new node is inserted in the left subtree of the left child of a, perform single right rotation.
Case II: If new node is inserted in the right subtree of the left child of a. perform left-right double rotation.
Case III: If new node is inserted in the left subtree of the right child of a. perform right-left double rotation.
Case IV: If new node is inserted in the right subtree of the right child of a, perform single left rotation.

All these cases are discussed with the help of examples in handouts.
Now where specifically, you are facing problem in understanding?
Do some practice on the examples given in handouts or book, send me your effort at cs301@vu.edu.pk and point out the exact area where you are facing problem.

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is difference among Binary Tree, Complete Binary Tree and Binary Search Tree? Vuhelper 2 4,477 03-18-2012, 12:47 AM
Last Post: Xpert
  Threaded Binary Tree? in C++ 2012 Vuhelper 0 3,570 01-06-2012, 12:25 AM
Last Post: Vuhelper
  how stack operation proves costly during traversing a tree Vuhelper 0 1,589 01-04-2012, 10:43 PM
Last Post: Vuhelper
  why huffman tree is not an AVL tree not how? Vuhelper 0 2,123 01-04-2012, 10:39 PM
Last Post: Vuhelper
  why Hoffman tree is not an AVL Tree? Vuhelper 0 2,191 01-04-2012, 10:33 PM
Last Post: Vuhelper
  how to insert a new node on AVL tree using double rotation? Vuhelper 0 2,752 01-04-2012, 10:31 PM
Last Post: Vuhelper
  the method of balancing an anl tree? Vuhelper 0 3,050 01-04-2012, 10:30 PM
Last Post: Vuhelper
  Balance of the AVL tree im Data structure 2012 Vuhelper 0 1,969 01-04-2012, 10:27 PM
Last Post: Vuhelper
  depth of binary search tree d=log2(n+1) - 1 if n = 1000000 how answer is 20 Vuhelper 0 2,394 01-04-2012, 10:25 PM
Last Post: Vuhelper
  the uses of queues and stacks? the application of binery tree? in C++ 2012 Vuhelper 0 1,745 01-04-2012, 10:24 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support