Introduction to Data Structure

data structure

A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.

In other words, A data structure is a way of storing data in a computer memory, so that it can be retrieved and manipulate efficiently. It is an organization of mathematical and logical concepts of data.

Generally people got confuse with data types and data structures. But there is a big difference between these two terms. A data type is a well-defined collection of data with a well-defined set of operations on it whereas A data structure is an actual implementation of a particular abstract data type.

Types of Data Structures:

Data Structures can be categorized in basic  two types-

  1. Linear Data Structure
  2. Non Linear Data Structure

1.    Linear data structures

Linear data structures organize their data elements in a linear fashion, where data elements are attached one after the other. Linear data structure is linear if element is adjacent to each other. It has exactly two neighbors elements to which it is connected as its previous and next member. Data elements in a liner data structure are traversed one after the other and only one element can be directly reached while traversing. Linear data structures are very easy to implement, since the memory of the computer is also organized in a linear fashion.

Some commonly used linear data structures are-

  • Array:  An array is a collection of data elements where each element could be identified     using an index.
  • Linked list: A linked list is a sequence of nodes, where each node is made up of a data element and a reference to the next node in the sequence.
  • Stack: A stack is actually a list where data elements can only be added or removed from the top of the list.
  • Queue: A queue is also a list, where data elements can be added from one end of the list and removed from the other end of the list.

 2.  Nonlinear data structures

In nonlinear data structures, data elements are not organized in a sequential fashion. A data item in a nonlinear data structure could be attached to several other data elements to reflect a special relationship among them and all the data items cannot be traversed in a single run.

Some commonly used linear data structures are-

  • Tree: A tree is a data structure that is made up of a set of linked nodes, which can be used to represent a hierarchical relationship among data elements.
  • Graph: A graph is a data structure that is made up of a finite set of edges and vertices. Edges represent connections or relationships among vertices that stores data elements.

Difference between Linear and Nonlinear Data Structures

Main difference between linear and nonlinear data structures lie in the way they organize data elements. In linear data structures, data elements are organized sequentially and therefore they are easy to implement in the computer’s memory. In nonlinear data structures, a data element can be attached to several other data elements to represent specific relationships that exist among them. Due to this nonlinear structure, they might be difficult to be implemented in computer’s linear memory compared to implementing linear data structures.

Mohit Arora
Follow me