Open In App

Data Structures Tutorial

Last Updated : 11 Jun, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Data structures are the fundamental building blocks of computer programming. They define how data is organized, stored, and manipulated within a program. Understanding data structures is very important for developing efficient and effective algorithms. In this tutorial, we will explore the most commonly used data structures, including arrays, linked lists, stacks, queues, trees, and graphs.

What is Data Structure?

A data structure is a storage that is used to store and organize data. It is a way of arranging data on a computer so that it can be accessed and updated efficiently.

A data structure is not only used for organizing the data. It is also used for processing, retrieving, and storing data. There are different basic and advanced types of data structures that are used in almost every program or software system that has been developed. So we must have good knowledge about data structures. 

Get Hands-on With Data Structures and Algorithms

Master fundamental computer science concepts to solve real-world problems and ace coding interview questions with Educative’s interactive course Data Structures and Algorithms in Python. Sign up at Educative.io with the code GEEKS10 to save 10% on your subscription.

Classification of Data Structure:

Classification of Data Structure

  1. Linear Data Structure: Data structure in which data elements are arranged sequentially or linearly, where each element is attached to its previous and next adjacent elements, is called a linear data structure. 
    Example: Array, Stack, Queue, Linked List, etc.
  2. Static Data Structure: Static data structure has a fixed memory size. It is easier to access the elements in a static data structure. 
    Example: array.
  3. Dynamic Data Structure: In dynamic data structure, the size is not fixed. It can be randomly updated during the runtime which may be considered efficient concerning the memory (space) complexity of the code. 
    Example: Queue, Stack, etc.
  4. Non-Linear Data Structure: Data structures where data elements are not placed sequentially or linearly are called non-linear data structures. In a non-linear data structure, we can’t traverse all the elements in a single run only. 
    Examples: Trees and Graphs.

Introduction to Data Structures:

Array Data Structure:

All Articles on Array
Coding Practice on Array
Quiz on Array
Coding Practice on Array
Recent Articles on Array

Linked List Data Structure:

1. Singly Linked List:

2. Circular Linked List:

3. Doubly Linked List:

All Articles of Linked List
Coding Practice on Linked List
Recent Articles on Linked List

Matrix Data Structure:

All Articles on Matrix
Coding Practice on Matrix
Recent Articles on Matrix.

Stack Data Structure:

All Articles on Stack
Coding Practice on Stack
Recent Articles on Stack

Queue Data Structure:

All Articles on Queue
Coding Practice on Queue
Recent Articles on Queue

Binary Tree Data Structure:

All articles on Binary Tree
Coding Practice on Binary Tree
Recent Articles on Tree

Binary Search Tree Data Structure:

All Articles on Binary Search Tree
Coding Practice on Binary Search Tree
Recent Articles on BST

Heap Data Structure:

All Articles on Heap
Coding Practice on Heap
Recent Articles on Heap

Hashing Data Structure:

All Articles on Hashing
Coding Practice on Hashing
Recent Articles on Hashing

Graph Data Structure:

All Articles on Graph Data Structure
Coding Practice on Graph
Recent Articles on Graph

Advanced Data Structure:

1. Advanced Lists:

2. Segment Tree Data Structure:

All Articles on Segment Tre

3. Trie Data Structure:

All Articles on Trie

4. Binary Indexed Tree Data Structure:

All Articles on Binary Indexed Tree

5. Suffix Array and Suffix Tree:

All Articles on Suffix Tree

6. AVL Tree:

7. Splay Tree:

8. B Tree:

9. Red-Black Tree:

All Articles on Self-Balancing BSTs

10. K Dimensional Tree:

Others Data Structures:

Misc:



Previous Article
Next Article

Similar Reads

Does a Data Scientist/Machine Learning Engineer require in depth knowledge of Data Structures and Algorithms?
In today's world, data scientists and machine learning engineers play a crucial role in analyzing data and building intelligent systems. As technology continues to advance, the demand for these experts is growing rapidly. Real-world data problems are complex, requiring strong skills in handling data and creating efficient algorithms. In this articl
10 min read
Data Structures | Linked List | Question 1
What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head == NULL) return; fun1(head->next); printf(\"%d \", head->data); } (A) Prints all nodes of linked lists (B) Prints all nodes of linked list in reverse order (C) Prints alternate nodes of Linked List (D) Prints alternate n
2 min read
Data Structures | Stack | Question 1
Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) { Stack S; // Say it creates an empty stack S while (n > 0) { // This line pushes the value of n%2 to stack S push(&S, n%2); n = n/2; } // Run while Stack S is not empty while (!isEmpty(&S)) printf("
1 min read
Data Structures | Queue | Question 1
Following is C like pseudo-code of a function that takes a Queue as an argument, and uses a stack S to do processing. C/C++ Code void fun(Queue *Q) { Stack S; // Say it creates an empty stack S // Run while Q is not empty while (!isEmpty(Q)) { // deQueue an item from Q and push the dequeued item to S push(&S, deQueue(Q)); } // Run while Stack S is
1 min read
Data Structures | Stack | Question 2
Which one of the following is an application of Stack Data Structure? (A) Managing function calls (B) The stock span problem (C) Arithmetic expression evaluation (D) All of the above Answer: (D) Explanation: See http://en.wikipedia.org/wiki/Stack_(abstract_data_type)#Applications
1 min read
Data Structures | Linked List | Question 2
Which of the following points is/are true about Linked List data structure when it is compared with array? (A) Arrays have better cache locality that can make them better in terms of performance. (B) It is easy to insert and delete elements in Linked List (C) Random access is not allowed in a typical implementation of Linked Lists (D) The size of a
2 min read
Data Structures | Linked List | Question 3
Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has previous pointer as prev and next pointer as next. C/C++ Code void fun(struct node **head_ref) { struct node *temp = NULL; struct node *current = *head_ref; while (current != NULL) { temp = current->prev; c
2 min read
Data Structures | Queue | Question 2
Which one of the following is an application of Queue Data Structure? (A) When a resource is shared among multiple consumers. (B) When data is transferred asynchronously (data not necessarily received at same rate as sent) between two processes (C) Load Balancing (D) All of the above Answer: (D) Explanation: (A) When a resource is shared among mult
2 min read
Data Structures | Binary Trees | Question 1
Which of the following is true about Binary Trees? (A) Every binary tree is either complete or full. (B) Every complete binary tree is also a full binary tree. (C) Every full binary tree is also a complete binary tree. (D) No binary tree is both complete and full. (E) None of the above Answer: (E)Explanation: A full binary tree (sometimes proper bi
2 min read
Data Structures | Tree Traversals | Question 1
Following function is supposed to calculate the maximum depth or height of a Binary tree -- the number of nodes along the longest path from the root node down to the farthest leaf node. int maxDepth(struct node* node) { if (node==NULL) return 0; else { /* compute the depth of each subtree */ int lDepth = maxDepth(node->left); int rDepth = maxDep
1 min read
three90RightbarBannerImg