0

I'm trying to find out what are the minimum and maximum number of nodes in a 2-3 Tree with n leaves.

I have tried blocking it with inf\sup but I couldnt go further then that the number of nodes in a 2-3 Tree is bigger then the number of nodes in a full-AVL tree.

Thanks in advance

Nadav Peled
  • 951
  • 1
  • 13
  • 19

1 Answers1

0

Operating under the definition of a 2-3 tree at wikipedia:

In computer science, a 2–3 tree is a type of data structure, a tree where every node with children (internal node) has either two children (2-node) and one data element or three children (3-nodes) and two data elements. Nodes on the outside of the tree (leaf nodes) have no children and one or two data elements.

It appears to me that the maximum number of nodes in a tree will be when each internal node has 3 children. In order to find the maximum number of nodes in that tree, we must first find the height of the tree.

If there are n leaves in this 3 tree, then the height of the tree is height = log3(n) (log base 3 of n) and so the max number of items would be 3^height.

The smallest tree is one which has the smallest number of elements, which would be a tree with a single node.

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
David Weiser
  • 5,190
  • 4
  • 28
  • 35