Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
in Blog Post by 64 69 85

What is Data Structure?

Data Structure is a specific way to organize and store data in computer memory.

It is important to choose the right Data Structure for your project. For example, if you want to store data sequentially in the memory then you need to use one of the type’s Linear Data Structure.

Data Structure Types

The Data Structure has two types:

  1. Linear Data Structure.
  2. Non-Linear Data Structure.

And each type has its once types and the diagram below explains the types of Linear and Non-Linear.

data structure

1) Linear Data Structure

A Linear Data Structure can store the data linearly or sequentially in the memory.

It includes the data at a single level such that we can traverse all data into a single run.

The implementation of Linear Data Structure is easier as the elements are sequentially organized in memory.

Types of Linear Data Structure

There are four types of linear data structure:

  1. Array.
  2. Linked list.
  3. Stack.
  4. Queue.

linear data structure

Array: is a collection of items stored in memory. The idea is to store multiple items of the same type together. And you can access a random element in the array.

Also read: How to use Array in c#.

Liked list: is a sequence of links that contain items. Each contains a connection to another link.

Also read: How to use Linked List in C#.

Stack: follows a particular order named LIFO stands for Last-In-First-Out which means the last item in the list is the first item to out. And it’s an abstract data type with a pre-defined capacity.

Also read: How to use Stack in C#.

Queue: is similar to a Queue in the real world. In which whatever comes first will go out first, and it follows the FIFO (First-In-First-Out) policy.

Also read: What is Queue and How to use it in C#.

2) Non-Linear Data Structure

A Non-Linear Data Structure is a data that is connected to its previous, next, and more elements like a complex structure. In simple terms, data is not organized sequentially.

  • There are multiple levels into Non-Linear Data Structure and also called a multilevel data structure.
  • We can’t implement Non-Linear Data Structures as easily as linear data structures.

Types of Non-Linear Data Structure

There are two types of Non-Linear Data Structure:

  1. Tree
  2. Graph

non-linear data structure

Tree: it represents the nodes connected by edges, node it’s like an item or element in an Array which contains data.

Also, read Tree in Data Structure using C#.

Graph: it is a collection of vertices that are connected to other vertices by edges.

Also read: How to use Graph and BFS in C#.

Linear Data Structure vs Non-Linear Data Structure


Linear Data Structure

Non-Linear Data Structure


Can be traversed in a single run.

Can’t be traversed in a single run.


Single level


elements connection

Only to its previous and next elements.

The element can connect more than two elements.

Time complexity

Increases with the increase in the input size.

Remains the same with the increase in the input size.


Easy to implement

complex to implement

See Also 

If you don’t ask, the answer is always NO!