Closed Thread
Results 1 to 7 of 7

Thread: Balancing Binary Search Trees

  1. #1
    Daskill is offline Newbie
    Join Date
    Dec 2008
    Posts
    24
    Rep Power
    0

    Unhappy Balancing Binary Search Trees

    I'm having trouble grasping the theory of balancing binary search trees and I was wondering if someone in the know could explain it to me?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,478
    Blog Entries
    75
    Rep Power
    143

    Re: Balancing Binary Search Trees

    There's an important question before I attempt to address the question: Are you talking about height balancing or balancing for optimal searching or something else?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Daskill is offline Newbie
    Join Date
    Dec 2008
    Posts
    24
    Rep Power
    0

    Re: Balancing Binary Search Trees

    It doesn't say specifically, but I think it's height-balancing.

  5. #4
    Join Date
    Jul 2006
    Posts
    16,478
    Blog Entries
    75
    Rep Power
    143

    Re: Balancing Binary Search Trees

    OK, I'll have to do a little research (I haven't specifically studied the topic, but tend to pick these things up quickly). I'll try to have something later today.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  6. #5
    Daskill is offline Newbie
    Join Date
    Dec 2008
    Posts
    24
    Rep Power
    0

    Re: Balancing Binary Search Trees

    You're very kind, thank you.

  7. #6
    Join Date
    Jul 2006
    Posts
    16,478
    Blog Entries
    75
    Rep Power
    143

    Re: Balancing Binary Search Trees

    Wikipedia has a nice article on AVL trees (balanced binary trees) and an excellent diagram of the reassignments needed to shift it into balance. It's a pretty simple matter of shuffling some pointers around.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    Join Date
    Jul 2006
    Location
    Amherst, New York, United States
    Posts
    6,277
    Blog Entries
    26
    Rep Power
    20

    Re: Balancing Binary Search Trees

    It should be noted that an AVL Tree is a specific type of Binary Search Tree (which itself is a specific type of a Binary Tree). Generally speaking, a Binary Search Tree makes no restriction on its hight; A BST only has an order property and it requires that the left child is less than its parent and the right child is greater than its parent. So in the best case scenario, a BST it could be logarithmic in size or in the worst case it could be linear in size. An AVL tree prevents the worst case scenario, and is thus a bit more complicated.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Binary trees structure comparison
    By Slammerek in forum C and C++
    Replies: 2
    Last Post: 07-14-2011, 07:55 AM
  2. Traversal of binary search trees
    By kakariki in forum General Programming
    Replies: 3
    Last Post: 07-14-2011, 07:52 AM
  3. [Help] MFC maze (Binary Trees)
    By Beeko in forum C and C++
    Replies: 12
    Last Post: 01-04-2011, 10:21 PM
  4. Need help with binary trees.
    By Daskill in forum General Programming
    Replies: 9
    Last Post: 12-08-2008, 08:13 AM
  5. Binary Trees in C
    By Salrandin in forum C and C++
    Replies: 4
    Last Post: 12-02-2007, 02:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts