Introduction to Data Structures
Why Data Structures Matter in Real
Life
2-Hour Class for First-Year
Engineering Students
Arrays
• 0 10 20 30 40
Collection of elements of same type, fixed size.
• Example: Student marks, Image pixels.
[0] [1] [2] [3] [4]
• Limitation: Insertion/deletion costly.
Stack
Item 4 Push →
Item 3
• ItemOut).
Follows LIFO principle (Last In, First 2
• Operations: Push, Pop, Peek.
Item 1 ← Pop
• Examples: Undo in Word, Browser back button.
• Analogy: Stack of plates.
Queue
Enqueue → Q1 Q2 Q3 Q4 Q5 Dequeue →
• Follows FIFO principle (First In, First Out).
• Operations: Enqueue, Dequeue.
• Examples: Ticket booking, Printer queue, CPU scheduling.
• Analogy: People standing in a line.
Tree
Root
• Hierarchical structure with parent-child relationships.
• Examples: Family tree, File system.
• Operations: Traversals.
L R
Graph
• A B
Collection of nodes (vertices) and connections (edges).
• Examples: Social networks, Google Maps routing.
• Useful for representing relationships and networks.
C D