Thread: AVL trees

  1. #1
    Registered User
    Join Date
    Mar 2011

    AVL trees

    hi guys,

    i have a project on c to implement a dictionary depending on the avl trees
    the trouble is that i can't find a condition that applies to perform the double rotation
    the structure is

     typedef struct node *avlptr;
    struct node{
    char[15] word;
    avlptr left;
    avlptr right;
    int height;

  2. #2
    Registered User
    Join Date
    Nov 2010
    Long Beach, CA
    Take a look at the Wikipedia article for AVL trees: AVL tree - Wikipedia, the free encyclopedia. They have a diagram on the right showing different types of rotations. The case of a left-right or right-left require a double rotation to balance. Read section 1.2 "Insertion" and look at the diagrams. They describe exactly the types of imbalance that require double rotation, and what rotations will balance the tree.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Delete Function for AVL Trees
    By Lost in forum C Programming
    Replies: 5
    Last Post: 08-24-2009, 10:34 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. AVL & BS Trees
    By sweets in forum C++ Programming
    Replies: 1
    Last Post: 04-14-2004, 04:49 PM
  4. Structures, pointers and AVL trees
    By Mark Shatford in forum C Programming
    Replies: 1
    Last Post: 06-28-2002, 11:31 AM
  5. AVL Trees
    By kwigibo in forum C Programming
    Replies: 2
    Last Post: 04-17-2002, 05:46 PM

Tags for this Thread