Computer >> Computer tutorials >  >> Programming >> Programming

Multi-Way Trees


A multiway tree is defined as a tree that can have more than two children. If a multiway tree can have maximum m children, then this tree is called as multiway tree of order m (or an m-way tree).

As with the other trees that have been studied, the nodes in an m-way tree will be made up of m-1 key fields and pointers to children.

multiway tree of order 5

Multi-Way Trees

To make the processing of m-way trees easier some type of constraint or order will be imposed on the keys within each node, resulting in a multiway search tree of order m (or an m-way search tree). By definition an m-way search tree is a m-way tree in which following condition should be satisfied −

  • Each node is associated with m children and m-1 key fields
  • The keys in each node are arranged in ascending order.
  • The keys in the first j children are less than the j-th key.
  • The keys in the last m-j children are higher than the j-th key.