Looking for hosting? Read HostGator review to find 7 arguments in support of HostGator.

Binary tree

Binary tree is a widely-used tree data structure. Feature of a binary tree, which distinguish it from common tree, is that each node has at most two children. Widespread usage of binary tree is as a basic structure for binary search tree. Each binary tree has following groups of nodes:

  • Root: the topmost node in a tree. It is a kind of "main node" in the tree, because all other nodes can be reached from root. Also, root has no parent. It is the node, at which operations on tree begin (commonly).
  • Internal nodes: these nodes has a parent (root node is not an internal node) and at least one child.
  • Leaf nodes: these nodes has a parent, but has no children.
Let us see an example of a binary tree.

Example of a binary tree

binary tree example

Operations

Basically, we can only define traversals for binary tree as possible operations: root-left-right (preorder), left-right-root (postorder) and left-root-right (inorder) traversals. We will speak about them in detail later.

Implementations

Partners Ads        dior sunglasses        garden lights        

Leave a reply

Your name (optional):
Your e-mail (optional):
Message: