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 7 2226
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.... ab******@hotmai l.com wrote: 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.
--
"If you want to post a followup via groups.google.c om, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
On Mon, 07 Mar 2005 13:50:03 -0800, abhrajit wrote: 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.programmin g.
For libraries you might try asking in comp.sources.wa nted. 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.programmin g.
Lawrence
Lawrence: Thanks for the newsgroup pointers. Will take my woes there. zr****@gmail.co m wrote: 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). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: abhrajit |
last post by:
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
/ \
|
by: Jimmy |
last post by:
Hi everyone,
I am working with a binary tree, and I am having a bit of trouble
visuallizing what needs to happen when I am trying to
delete a node that has two children. (no child node and one child node were
trivial).
Does anyone know the solution to this problem?
void CTree::Delete(CPerson *&pPerson)
|
by: Zri Man |
last post by:
I'm relatively new to DB2 and was reasonably amused to see the REVERSE
SCAN availability for Indexes.
My assumptions are as follows:
DB2/UDB uses B-Tree for indexing by default and is likely the main
offering for Indexing within the DB.
Reverse Scans could possibly only happen on the the leaf node of
the index
|
by: prabhat143 |
last post by:
Hi,
Given a singly linked, null terminated list, how can it be converted to
tree? Each node in the list has three attributes: it's ID, it's parent
ID and of course, the next node it's pointing to. The parent id of root
of the tree is 0. The length of list is not known. What will be the
optimal solution?
Node* convertToTree(Node* listHead);
|
by: Steve Edwards |
last post by:
Hi,
I have a class which contains a single ptr to another instance which is
considered its parent, and an array of ptrs to its children
class Nodes{
....
Nodes *mSuper;
| |
by: whitehatmiracle |
last post by:
Hello
I have written a program for a binary tree. On compiling one has to
first chose option 1 and then delete or search. Im having some trouble
with the balancing function. It seems to be going into an infinite
loop, i think im messing up with the pointers.
Heres the code.
//press 1, first, Do not press it a second time!!!
|
by: sake |
last post by:
Hey everyone, I need a little help with my binary tree program. The purpose of this program is just an exercise for myself, but for some reason it doesn't work. It's supposed to input words "One" through "Ten" into the binary tree(left side is alphabetically less than the top node, right is more) and I believe I've done that(but probably not). The problem is that with the read() function, it only displays three words, when they were supposed to...
|
by: Defected |
last post by:
Hi,
How i can implement a main function with this Binary Search Tree.
thanks for help.
is this code corrected ?
#include<iostream>
|
by: hankypan1 |
last post by:
Hi All,
I need a tree data structure for my application. It is the non -cyclic
simple tree where i can have any number of children node and each
child can recursively become a sub tree like a normal tree. Now the
thing is i can popullate my tree at compile time like a global data.
Since
i know my tree definition at compile time, instead of using pointers
to point to siblings or child nodes, i am planning to use the array
with...
|
by: pereges |
last post by:
Hi, I'm trying to deallocate a kd tree which I created dynamically.
There were no problems
creating the structure and I can access it easily but there is a
problem while trying to free
it. Here's the structure for the a single node in the tree:
typedef struct kdnode_s
{
bbox box; /* Bounding box */
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |