File tree Expand file tree Collapse file tree
Linear_Data_Structures/02_Queue Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # 🚶 Queue — Linear Data Structure
2+
3+ ## 🎯 Concept
4+ Queue follows ** FIFO (First In, First Out)** — the first inserted element is removed first.
5+
6+ ---
7+
8+ ## ⚙️ Core Operations
9+
10+ | Operation | Description | Time Complexity |
11+ | ------------| --------------| -----------------|
12+ | ` enqueue() ` | Add element to rear | O(1) |
13+ | ` dequeue() ` | Remove element from front | O(1) |
14+ | ` peek() ` | View front element | O(1) |
15+ | ` isEmpty() ` | Check if queue is empty | O(1) |
16+
17+ ---
18+
19+ ## 🧠 Real-Life Analogies
20+ - People waiting in line at a counter.
21+ - Printer job queue.
22+ - CPU process scheduling.
23+
24+ ---
25+
26+ ## 🧩 Variants
27+ - ** Circular Queue** – Reuses space efficiently.
28+ - ** Priority Queue** – Serves elements based on importance, not arrival.
29+
30+ ---
31+
32+ ## 🧠 Applications
33+ - Process scheduling
34+ - Call center routing
35+ - IO buffering
36+ - Message queues
37+
38+ > ✨ “Queue teaches patience — whoever comes first gets served first.” ✨
You can’t perform that action at this time.
0 commit comments