📖 Chapters
- 1. Introduction to DSA and Its Importance
- 2. Time and Space Complexity (Big O, Θ, Ω)
- 3. Recursion and Stack Memory
- 4. Mathematics for DSA (GCD, LCM, Modulo Arithmetic)
- 5. Arrays: Basics and Operations
- 6. Strings: Manipulation & Inbuilt Functions
- 7. Structures and Unions with Arrays
- 8. Linked Lists (Singly, Circular, Doubly)
- 9. Stack (Using Array & Linked List)
- 10. Queue (Simple, Circular, Deque)
- 11. Linear Search & Binary Search
- 12. Sorting Basics: Bubble, Selection, Insertion
- 13. Merge Sort
- 14. Quick Sort
- 15. Counting Sort, Radix Sort, Bucket Sort
- 16. Heap Sort
- 17. Binary Trees & Representations
- 18. Binary Tree Traversals (Pre, In, Post)
- 19. Binary Search Tree (BST)
- 20. AVL Trees (Self-balancing BST)
- 21. Trie (Prefix Tree)
- 22. Segment Tree (Range Queries)
- 23. Fenwick Tree / Binary Indexed Tree (BIT)
- 24. Heap & Priority Queues (Min-Heap, Max-Heap)
- 25. Hashing and Hash Tables
- 26. Disjoint Set Union (Union-Find, Path Compression)
- 27. Sparse Tables
- 28. Sliding Window Technique
- 29. Two Pointers Technique
- 30. Graph Representations (Adjacency Matrix & List)
- 31. BFS and DFS (Traversal & Search)
- 32. Topological Sort (Kahn’s & DFS)
- 33. Shortest Path Algorithms (Dijkstra, Bellman-Ford)
- 34. Minimum Spanning Tree (Kruskal, Prim)
- 35. Cycle Detection in Graphs
- 36. Bridges and Articulation Points
- 37. Greedy Algorithms (Activity Selection, Huffman Coding)
- 38. Backtracking (N-Queens, Sudoku Solver)
- 39. Dynamic Programming (Intro, Memoization, Tabulation)
- 40. Advanced DP (LIS, Knapsack, DP on Trees/Grids)
- 41. Bit Manipulation and XOR Tricks
- 42. Interview Problems from FAANG Companies
- 43. Competitive Coding Patterns
- 44. Building Mini Projects Using DSA (Menu-driven)
- 45. Final Quiz + Problem Sheet (100+ questions)
- 46. Next Steps: Competitive Programming or System Design?
Data Structures and Algorithms in C (DSA)
Category: IT Fundamentals & Programming
This course is designed to help learners master the core concepts of Data Structures and Algorithms (DSA) using the C programming language. Starting from the basics and advancing to complex topics like graphs, dynamic programming, and memory optimization, this course …
Queue (Simple, Circular, Deque)
📘 Queue (Simple, Circular, Deque)
A Queue is a linear data structure that follows the FIFO (First In, First Out) principle. The element added first is removed first — like a real-life line (queue) at a ticket counter.
📌 Real-World Applications
- Printer task scheduling
- Operating system job scheduling
- Data buffering (e.g., keyboard buffer, IO queues)
- Customer service request handling
🔢 Basic Operations
- Enqueue: Insert item at rear
- Dequeue: Remove item from front
- Front: Access front element
- isEmpty / isFull: Check state of queue
🔧 Queue Using Array (Static Queue)
#define SIZE 100 int queue[SIZE]; int front = -1, rear = -1; void enqueue(int val) { if (rear == SIZE - 1) printf("Queue Overflow\n"); else { if (front == -1) front = 0; queue[++rear] = val; } } int dequeue() { if (front == -1 || front > rear) printf("Queue Underflow\n"); else return queue[front++]; }
🔁 Circular Queue
A Circular Queue connects rear back to front in a circular fashion to efficiently use space.
- Prevents wasted space when front index moves forward
- Common in IO buffers
⏪ Double Ended Queue (Deque)
Deque stands for Double-Ended Queue — where insertion and deletion can occur at both ends.
- Input-restricted: insertion at one end, deletion both ends
- Output-restricted: deletion at one end, insertion both ends
🧱 Queue Using Linked List (Dynamic Queue)
struct Node { int data; struct Node* next; }; struct Node *front = NULL, *rear = NULL; void enqueue(int val) { struct Node* newNode = (struct Node*)malloc(sizeof(struct Node)); newNode->data = val; newNode->next = NULL; if (rear == NULL) { front = rear = newNode; } else { rear->next = newNode; rear = newNode; } } int dequeue() { if (front == NULL) return -1; int val = front->data; struct Node* temp = front; front = front->next; if (front == NULL) rear = NULL; free(temp); return val; }
📚 Practice Tasks
- Implement static queue using array
- Write circular queue functions
- Use deque to check palindrome efficiently
- Simulate job queue with priority insertion (as bonus)
✅ Summary
- Queues follow FIFO order
- Can be static (array) or dynamic (linked list)
- Variants include Circular and Deque
- Widely used in scheduling and buffering problems
📤 Coming Next
In the next chapter, we will explore searching techniques — starting with Linear and Binary Search.