Thread: AVL & BS Trees

  1. #1
    Registered User
    Join Date
    Apr 2002

    AVL & BS Trees

    I have been working on a project for which I have been using my BSTree. Now, I have discovered that my tree is turning out to be horrifically unbalanced, thus my decision to convert to an AVL tree .

    Problem is, Im not sure if it possible to create an AVL tree from my BSTree and then convert to the AVL tree without disrupting everything else.

    simple is always an understatement.....

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    If your BSTree follows the guidelines of encapsulation then it shouldn't matter what implementation you use as long as you meet the requirements of the interface. For a simple tree, that means fixing the node structure so that it has a balance member and replacing the insertion and deletion code with AVL algorithms. None of that should require changes in the client code.
    My best code is written with the delete key.

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. Structures, pointers and AVL trees
    By Mark Shatford in forum C Programming
    Replies: 1
    Last Post: 06-28-2002, 11:31 AM
  4. AVL Trees
    By kwigibo in forum C Programming
    Replies: 2
    Last Post: 04-17-2002, 05:46 PM
  5. AVL trees
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 04-08-2002, 05:46 PM