1. Primitive Data Structures
Basic data types provided by a programming language:
-
Integer
-
Float
-
Boolean
-
Character
2. Non-Primitive Data Structures
These are more complex and built using primitive types.
a) Linear Data Structures
Data is arranged in a sequence.
-
Array – fixed-size list of elements stored in contiguous memory.
-
Linked List – elements (nodes) linked using pointers.
-
Stack – follows LIFO (Last In, First Out).
-
Queue – follows FIFO (First In, First Out).
b) Non-Linear Data Structures
Data is arranged hierarchically or in relationships.
-
Tree – hierarchical structure (e.g., binary tree).
-
Graph – set of nodes connected by edges.
-
Heap – special tree-based structure used in priority queues.
c) Hash-based Structures
-
Hash Table – stores key–value pairs; offers fast lookup using hash functions.
Where You See Data Structures in Real Life
-
Social media uses graphs to model connections.
-
Navigation apps use trees and graphs for route planning.
-
Databases use B-trees and hash tables for fast search.
-
Compilers use stacks and trees for syntax analysis.