# Which data structure suits the most in the tree construction?

### Which data structure suits the most in the tree construction?

Depending on the type of tree, you can use multiple data structures to present a tree, if it is a segment tree or a fenwick tree, you can use an array data structure. If it is a type of N-ary tree, you can use a LinkedList type of data structure.

It depends on the data, and what you use the data for.

A simple binary tree allows a discriminate to select one of two sub trees.

A b+ tree allows a discriminate to select one of a number of sub trees.

Then there is sometimes the need to have a linear ordering of the tree (such as when the tree discriminate is priority). To quickly find the first entry you can look at the root of the tree - which then has a pointer to the leftmost leaf node. That leaf node then has two pointers - one to its parent, and one to the next entry. Thus quick to find, and easy to remove… and relatively quick to insert.

Then there are radix trees where the discriminate may be something like text - the left tree contains all words starting with “a”. The next entry (if in a b+ tree), would be words with b… all the way up to “z”.

The next level repeats with the next input (so the left tree would represent “aa” through “az”. And left tree would be “aaa” through “aaz”. It can make a dictionary search relatively fast.