Non Linear Data Structures

In Non Linear Data Structure, the data elements are not organized sequentially or linearly. To reflect a special relationships among different elements of non linear data structures, the data elements in such type of data structures can be connected with more then one elements.

One of the important characteristic of non linear data structures is that all the data items of non linear data structures may not be visited in one traversal. That means, if we want to visit all the nodes of non linear data structure then it may require more than one run.

Two most common example of non linear data structures are Tree and Graph.

  • Tree : Tree is a collection of nodes which creates parent child relationships. Nodes in a tree are stored hierarchically where top most node is the root node of the tree.
Non Linear Data Structure - Tree

Tree – Non Linear Data Structure

There are many types of trees in data structure. Some of important types are as follows:

    • General Tree
    • Binary Tree
    • Binary Search Tree
    • AVL Tree
    • 2-3 Tree
    • B Tree
    • B+ Tree
  • Graph : A Graph G(V,E) is defined as a collection of vertices V and collection of edges E which connects these vertices. Vertices store the data elements and edges can represent relationships among these vertices.
    Non Linear Data Structure - Graph

    Undirected Graph

    Types of Graphs are as follows:

    • Directed Graph
    • Undirected Graph
    • Weighted Graph