Sign InCoursewareNuggetsTutorials CoursesCodePad

Trees

Unlike arrays, linked lists, stacks and queues, which are linear data structures, trees are hierarchical data structures. In a linked list, each node has one link to the next node. In a tree each node may have two or more links to other nodes.


tree picture.
subtree picture.

A tree in computer science is usually drawn inverted when compared to the trees in nature. The topmost node is called root of the tree. The other nodes are called branches. The nodes that are directly under a node are called its children. The node directly above the nodes is called their parent. Nodes with the same parent are called siblings. Nodes with no children are called leaves. A subtree of a given node includes one of its children and all of that child's descendants.

© CS Wonders·About·Gallery·Fun Facts·Cheatsheet