RE: Help with an AVL TREE 06-12-2014, 10:28 AM
#11
(06-12-2014, 10:09 AM)Psycho_Coder Wrote:Yes, i understood.(06-12-2014, 10:03 AM)Apocalypse Wrote:(06-12-2014, 09:38 AM)Psycho_Coder Wrote: NO, My answer is correct and I did follow the sequence you gave. But he final graph will be this and I am very sure.Hm,
AVL tree is a height balanced tree and so after a certain condition the graphs undergo LL, RR, LR, RL or Double Rotation and due to the rotations the final root node will change.
I think you are getting confused with AVL or BST. Yes I was too lazy to write the weights in each nodebut the final AVL representation is what I gave.
EDIT : See this http://www.slideshare.net/patawad/binary...ee-and-avl
I found this http://www.cs.usfca.edu/~galles/visualiz...Ltree.html
You can generate the AVL using your values and see the tree that you obtain. My tree is correct
if i had a binary tree, would it be the same?
Which is the difference?
:Thumbs-Up:
A binary search tree (BST) is a binary tree data structure which has the following properties :
1. Every node in BST has a value;
2. a total order is defined on these values;
3. the left subtree of a node contains only values less than the node's value;
4. the right subtree of a node contains only values greater than or equal to the node's value.
An AVL tree on the other hand is a self-balancing binary search tree. In an AVL tree the heights of the two child subtrees of any node differ by at most one, and thereby it is known as height-balanced too. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases. Additions and deletions may require the tree to be rebalanced by one or more tree rotations like LL, RR, LR, RL or double rotation.
Do you know any algorithm about traversing across a complete binary tree ? (at C for example)
but the final AVL representation is what I gave.![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)
![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)
![[Image: l0TFyH0.jpg]](http://i.imgur.com/l0TFyH0.jpg)
![[Image: MUJ8qSW.png]](http://i.imgur.com/MUJ8qSW.png)