Hello All,

I would like to implement a tree with the following properties.

1. The tree is balanced.
2. Each node has a max of 7 sub nodes and min of ceil(7/2) sub nodes.
3. Number of nodes known from the beginning.

How would I implement this? Is there a data structure that I can use?

Consider the following scenario: I have 16 nodes and I want to create
a balanced tree such that each sub_node has a max of 7 nodes.
(example) I can create the tree in the following 2 ways:

Case 1: Make a root node, with 3 sub_nodes, 2 sub_nodes have 7 leaf
nodes and the third sub_node of the root node has 2 leaf nodes.

Case 2: Make a root node, with 3 sub_nodes, distribute the leaf nodes
such that all 3 sub_nodes have 5 leaf nodes and 1 of them has an
extra.

I am interested in case 2.

I must first construct this and then
be able to move around the leaf nodes and ensure that this 'balance'
is not lost.

I know I have to use AVL principles of rotation, but since text books
explain only for binary trees, i need some help on it.
Any ideas will be most helpful.

Thanks,
Vandana.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to