Balanced binary tree with fixed leaf nodes

A

abhrajit

I'm looking for a C/C++/Java library to create a balanced binary tree
data structure given a set of leaf nodes as input. A leaf node should
never become an interior node.

So if I wish to create a tree that will have a,b,c & d as leaf nodes -
this tree will contain nodes other than a,b,c & d as interior nodes:

e.g.
x
/ \
y z
/ \ / \
a b c d

The tree is balanced (to the extent possible) and all the input nodes
are leaves. (x,y,z are internal nodes that were not specified as
input).

Appreciate any help,
Abhrajit
 
A

abhrajit

Apologies for the cross post. There are plenty of libraries for binary
& balanced binary tree creation but none that meet my specific
requirements. Was hoping someone on this list may have an inkling....
 
C

CBFalconer

Apologies for the cross post. There are plenty of libraries for
binary & balanced binary tree creation but none that meet my
specific requirements. Was hoping someone on this list may have
an inkling....

The cure for the cross post is obvious - don't do it. F'ups set.

There are various ways of creating balanced binary trees. Look up
AVL (Adelson-Velski) trees and red-black trees. Ben Pfaffs
writings on trees are fairly definitive, and freely available.
Read Knuth and Sedgewick. Then write your own code if you don't
like what you find.
 
L

Lawrence Kirby

I'm looking for a C/C++/Java library to create a balanced binary tree
data structure given a set of leaf nodes as input. A leaf node should
never become an interior node.

A good place to discuss datastructures and algorithms is comp.programming.
For libraries you might try asking in comp.sources.wanted. Also according
to my newsreader there is a comp.lang.java hierarchy but no comp.lang.java
newsgroup.
So if I wish to create a tree that will have a,b,c & d as leaf nodes -
this tree will contain nodes other than a,b,c & d as interior nodes:

e.g.
x
/ \
y z
/ \ / \
a b c d

The tree is balanced (to the extent possible) and all the input nodes
are leaves. (x,y,z are internal nodes that were not specified as
input).

That's an unusual datastructure, most of this sort benefit from placing
data in internal nodes too. It might help if you explained why you can't
do this, probably in comp.programming.

Lawrence
 
Z

zrelli

hi ,

in bind9, there is a library called isc, useful AVL functions are
implemented there. I know that it exists by defulat in FreeBSD-5.3 but
it is not comiled.
you can compile the library independentely from the whole bind9 package
then use it.
 
S

scooter.phd

hi ,

in bind9, there is a library called isc, useful AVL functions are
implemented there. I know that it exists by defulat in FreeBSD-5.3 but
it is not comiled.
you can compile the library independentely from the whole bind9 package
then use it.

Paul Vixie wrote those routines many years ago and released them under
a BSD-style licence. They work well (I've used them before happily).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top