Data Structures Basics
Author: Tanu Keshari
Introduction
A Data Structure is a way of organizing, managing, and storing data for efficient access and
modification. It plays a crucial role in computer science and programming, enabling developers to
handle data effectively.
Types of Data Structures
1. Primitive Data Structures (int, char, float, etc.)
2. Non-Primitive Data Structures:
- Linear: Array, Linked List, Stack, Queue
- Non-Linear: Tree, Graph
Data Structures
Primitive Non-Primitive
Arrays
An array is a collection of elements stored at contiguous memory locations. It allows random access
using indices. Operations include Traversal, Insertion, and Deletion.
A[0] A[1] A[2] A[3] A[4]
Linked List
A linked list is a linear data structure where elements (nodes) are connected using pointers. Each
node contains data and a reference to the next node.
Node1 Node2 Node3
Stack
A stack is a linear data structure that follows the LIFO (Last In, First Out) principle. Operations:
Push (insert), Pop (delete), Peek (top element).
Item3
Item2
Item1
Queue
A queue is a linear data structure that follows the FIFO (First In, First Out) principle. Types: Simple
Queue, Circular Queue, Priority Queue, Double-Ended Queue.
Q1 Q2 Q3 Q4
Trees
A tree is a hierarchical data structure consisting of nodes. Binary Tree and Binary Search Tree
(BST) are common types. Traversals: Inorder, Preorder, Postorder.
B C
Graphs
A graph is a collection of nodes (vertices) and edges connecting them. Can be directed or
undirected. Representations: Adjacency Matrix, Adjacency List.
1 2
3
Hashing
Hashing is a technique to map data of arbitrary size to fixed-size values (hash codes). Used in hash
tables for fast data retrieval. Collision handling methods include Chaining and Open Addressing.
H0
Data
H1
H2
Applications & Conclusion
Applications of Data Structures: - Operating Systems (Process Scheduling) - Databases (Indexing,
Searching) - Artificial Intelligence (Graphs, Trees) - Networks (Routing Algorithms) Conclusion:
Data Structures form the foundation of efficient programming and problem solving. Mastering them
is essential for computer science students and professionals.