Classification of Data Structure

By Nischal Lal Shrestha | On Tue, Sep 17 2019 | Filed under Algorithm

Image for Classification of Data Structure

Classification of Data Structure

A Data Structure, as the name suggests, is a method to store data in a structured way so that it can be easily created, viewed, and managed.

Bad programmers worry about the code. Good programmers worry about data structures and their relationships.

Linus Torvalds

How do we classify data structures?

Data Structures are generally classified into two classes:

  1. Primitive Data Structures

  2. Non-primitive Data Structures

Primitive Data Structures

Primitive Data Structures are the fundamental data types which are supported by programming language. They are created without the support of other data structure as a support or tool. Examples:

  • Integer
  • Real (float)
  • Characters
  • Booleans

Note: Between the two major classification of data structure, primitive data structure is less choose due to its inflexible nature.

Non-Primitive Data Structures

Non-primitive Data Structures are created using primitive data structures. Non-primitive data structures are more complicated data structures and are derived from primitive data structures.These Data Structures can be designed by users.

Examples:

  • Lists
  • Graphs
  • Stacks
  • Trees

Due to its flexible nature, between the two major classification of data structure, Non-primitive data structure is choosen more.

Non-Primitive Data Structures can further be classified into two categories:

  1. Linear Data Structures

  2. Non-Linear Data Structures

Linear Data Structures

In a Linear Data Structure, the elements of Data Structure are stored in a linear or sequential order. Examples:

  • Arrays
  • Linked Lists
  • Stacks:

Stack is a linear data structure where the addition of new items and the removal of existing items always takes place at the same end. This end is commonly called as "top". As all the addition and removal in a stack is done from the "top" of the stack, the item added most recently will be removed first. Hence stack is called Last-In-First-Out(LIFO) data structure.

  • Queues

Non-Linear Data Structures

If the elements of a Data Structure are not stored in a sequential order, then it is a Non-Linear Data Structure. Examples:

  • Trees
  • Graphs