Building a balanced binary search tree

Posted by Znarkus on Stack Overflow See other posts from Stack Overflow or by Znarkus
Published on 2010-05-23T20:30:45Z Indexed on 2010/05/23 20:40 UTC
Read the original article Hit count: 207

Filed under:

Hi!

Is there a method to build a balanced binary search tree?

Example:

1 2 3 4 5 6 7 8 9

       5
      / \
     3   etc
    / \
   2   4
  /
 1

I'm thinking there is a method to do this, without using the more complex self-balancing trees. Otherwise I can do it on my own, but someone probably have done this already :)

© Stack Overflow or respective owner

Related posts about binary-trees