code

A tree is a data structure used for storing data. It is based on the mathematical tree, which is defined as a simple connected undirected acyclic graph. Trees in computer science represent a simple connected directed acyclic graph, where the origin of operations start with the root node.

Trees are especially efficient in the searching of sorting lists, as opposed to linked lists, which require strict sequential access. Trees are also important in some applications that require specifically the tree data structure.

Trees are made up of items known as nodes (equivalent to vertices in graphs). As in linked lists, nodes typically consists of pieces of useful data and one or more pointers to its children nodes.

Operations

Depending on the specific implementation, a tree may have different operations that may be done with it.

Traversal

Traversal is a means of listing all the nodes in a tree.

See also