Binary Search Tree data structures explained

A Binary Search Tree is a Binary tree in which all the nodes have following properties.

  • Left subtree of a node contains all the nodes having values lesser than the node.
  • Right subtree of a node contains all the nodes having values higher than the node.
  • Both the left and right subtree is also a Binary Search Tree.

As the name suggests, this data structure is mainly used for faster searching. In order to do that, restrictions are applied while inserting/deleting an element into the tree. As a result of these restrictions, worst case search time complexity remains at O(log n).

Below are some examples of Binary Search Trees.

(more…)
Binary Search Tree data structures explained Read More

Binary Tree data structures explained

Tree data structures are similar to Linked list in which each node points to multiple nodes instead of simply pointing to the next node. A tree is called Binary tree if each node in a tree has maximum of two nodes.

An empty tree is also a Binary tree. We can call the two children of each node as Left and Right child of a node. The node of the tree which has no parent is called the Root of the tree. Perhaps Binary tree is the most used tree data structure in the programming world.

Below are some examples of Binary Tree.

(more…)
Binary Tree data structures explained Read More

Queue data structures explained

Queue data structures are used for storing collection of data where order in which data is arriving is important. In Queue, insertion and deletion both happened from the different end.
Data insertion are done at one end which is known as “rear end” while data deletion are done at other end known as “front end“. The data which is arrived first will be deleted first in Queue.
This data ordering is called as First in First out or FIFO.

(more…)
Queue data structures explained Read More

Hash Table data structures explained

Hashing is a technique used to search an specific item in large group of items. Hashing uses hash table to perform search in an constant O(1) time. Hashing uses hash functions to fill items in a hash table. To search, each key is passed into the same hash function which computes an index which provides the corresponding value location.

A Hash table data structures are used in hashing which stores all the key value pairs.

Let’s have a look at the ideal hash table.

(more…)
Hash Table data structures explained Read More

Graph data structures explained

Graph data structures contains a set of vertices which is called as Node, together with a set of collection of pair of vertices which is called as an Edge.
A graph data structure can be represented as a pair (V, E) where V is a set of nodes called vertices and E is a collection of pairs of vertices called edges.
Graphs are used to solve many real life problems such as fastest ways to go from A to B etc.

Let’s have a look into some graphical examples of Graphs.

(more…)
Graph data structures explained Read More

Linked List data structures explained

Linked List is a data structure used for storing collection of data where successive elements are connected through pointers and the size of linked list can grow or shrink dynamically.
Linked List data structure is a type of Linear data structures.
In short, Linked list can be thought as similar to array in which traversal can happen through pointers instead of indexes.

Let’s have a look into some graphical examples of Linked List.

(more…)
Linked List data structures explained Read More

Boundary Traversal Of A Binary Tree

A tree is a data structure similar to Linked list in which each node points to multiple nodes instead of simply pointing to the next node. A tree is called Binary tree if each node in a tree has maximum of two nodes.

Boundary traversal of a binary tree, traverses through all the boundary nodes which includes

  • The left boundary of a binary tree
  • All the leaves of the binary tree
  • The right boundary of a binary tree

Before going ahead have a look into Binary Tree basicsBinary Tree Traversal and Binary Tree implementation.

(more…)
Boundary Traversal Of A Binary Tree Read More

Program To Find the Lowest Common Ancestor In Binary Tree

A tree is a data structure similar to Linked list in which each node points to multiple nodes instead of simply pointing to the next node. A tree is called Binary tree if each node in a tree has maximum of two nodes.
The lowest common ancestor of any two nodes X and Y in a binary tree is the lowest node in tree that has both X and Y node as successor.
Before going ahead have a look into Binary Tree basicsBinary Tree Traversal and Binary Tree implementation.

(more…)
Program To Find the Lowest Common Ancestor In Binary Tree Read More

Program to Convert Binary Tree to Sum Tree

A tree is a data structure similar to Linked list in which each node points to multiple nodes instead of simply pointing to the next node. A tree is called Binary tree if each node in a tree has maximum of two nodes.
An empty tree is also a Binary tree. We can call the two children of each node as Left and Right child of a node. The node of the tree which has no parent is called the Root of the tree. Perhaps Binary tree is the most used tree data structure in the programming world. Before going ahead have a look into Binary Tree basicsBinary Tree Traversal and Binary Tree implementation.

(more…)
Program to Convert Binary Tree to Sum Tree Read More