Data Structure and Types

 

Data Structure and Types


in this article, you will learn about data structure and its types.

What is data Structure?

Data structure is a storage that is used to store and organize data. It is a way of arranging data on a computer to make it easily accessible and up to date.




Note: Data types and data structures differ slightly. The collection of data types arranged in a particular order is known as a data structure.


Types of Data Structure

Data structure is divided into two categories:

  • Linear data structure
  • Non-linear data structure


Linear Data Structure

A linear data structure is one in which the elements of the data are arranged sequentially or linearly, with each member being connected to its immediate neighbor and the neighbor after it. It is possible to traverse the entire linear data structure in a single run.


Types of Linear Data Structure

  • Array Data Structure
  • Queue Data Structure
  • Stack Data Structure
  • Linked List Data Structure


Array Data Structure

An array is a linear data structure that collects elements of the same data type and stores them in contiguous and adjacent memory locations. Arrays work on an index system starting from 0 to (n-1), where n is the size of the array.





Stack Data Structure

The data structure follows to the Last In-First Out (LIFO) principle, where the element that was most recently added is removed first. Data elements are added to a stack using the push operation, and data elements are removed using the pop operation. The example of stacked books can be used to explain this. All books stacked on top of the last book must be carefully removed in order to access the last book.


Queue Data Structure

A queue is a useful data structure in programming. It is similar to the ticket queue outside a cinema hall, where the first person entering the queue is the first person who gets the ticket.

Linked List Data Structure

In linked list data structure, data element are connected through a series of nodes. And, each node contains the data items and address to the next nodes.

Non-Linear Data Structure

Data structures where data elements are not arranged sequentially or linearly are called non-linear data structures. A non-linear data structure does not use a single level. As a result, we are unable to traverse all the elements in a single run. In contrast to linear data structures, non-linear data structures are more difficult to construct. Unlike a linear data structure, it efficiently uses computer memory. Trees and graphs are two examples.

Types of Non-linear data structure

  • Trees
  • Graph


Trees:

A tree data structure consists of various nodes linked together. A tree's structure is hierarchical, creating a relationship similar to that between a parent and a kid. Every parent-child node relationship in the tree's structure is represented by a single connection. There should be just one route from the tree's root to each node. Based on their structural characteristics, there are numerous sorts of trees, including AVL trees, binary trees, binary search trees, etc.

Graph:

Graphs are the non-linear data structures that have a predetermined number of vertices and edges. Data is stored on the vertices, also known as the nodes, and the edges display the connections between the vertices. A graph and a tree differ in that a graph has no set criteria for how nodes should be connected. The graphs can be used to illustrate real-world issues like social networks and telephone networks, among others.



Post a Comment

Previous Post Next Post