Tree - Data strucrure

Data structures like array, linked lists, stacks, queues are linear data structures.
Tree data structure is a non-linear data structure and its good to use in hierarchical data situations.

Image obtained from : http://www.teach-ict.com/as_as_computing/ocr/H447/F453/3_3_5/data_structures/miniweb/images/tree.jpg


Tree terminogy

Lets say we have a tree T with set of nodes where nodes have parent child relationship.

root - which has no parents. Only one root is in T
nodes - nodes other than root are called nodes and they all have a parent. and may be children as well
siblings - if some nodes share a same parent they are called siblings
internal nodes - If a node has children its is a internal nodes
external nodes/leaves - if a node has no children it is an external node or a leave
edge - A connection between parent and a child
path - sequence of edges from a source node to destination node
ordered tree - where siblings have a meaningful linear fashion relationship

There are various kinds of trees that can be implemented using these concepts.
Ex: Binary threes, red black treens, 234 trees.
Share:

0 comments: