A comprehensive collection of Data Structures and Algorithms implemented in C++. This repository serves as a learning resource and reference guide for fundamental computer science concepts.
This repository contains implementations of various data structures and algorithms in C++. Each topic is organized in its own directory with well-documented code examples and implementations.
| Folder | Description | Key Implementations | Complexity |
|---|---|---|---|
| Array | Linear data structure with contiguous memory allocation | Basic operations, searching, sorting, rotation | Access: O(1) |
| Linked_List | Dynamic linear data structure with nodes connected via pointers | Singly, Doubly, Circular variants | Insertion: O(1) |
| Stack | LIFO (Last In First Out) data structure | Push, Pop, Peek, Expression evaluation | Operations: O(1) |
| Queue | FIFO (First In First Out) data structure | Enqueue, Dequeue, Circular Queue, Priority Queue | Operations: O(1) |
| Tree | Hierarchical non-linear data structure | Binary Tree, BST, AVL, Heap, Traversals | Search: O(log n) |
| Graph | Non-linear structure representing nodes and edges | BFS, DFS, Shortest Path, Spanning Tree | Varies by algorithm |
| String | Sequence of characters | Pattern matching, manipulation, searching | Varies by operation |
| Category | Algorithms Included | Time Complexity |
|---|---|---|
| Searching | Linear Search, Binary Search | O(n), O(log n) |
| Sorting | Bubble, Selection, Insertion, Merge, Quick, Heap Sort | O(n²) to O(n log n) |
| Graph Traversal | BFS, DFS | O(V + E) |
| Shortest Path | Dijkstra's, Bellman-Ford | O(V²), O(VE) |
| Pattern | Use Cases | Example Problems |
|---|---|---|
| Two Pointer | Array/String traversal, Pair problems | Container with Most Water, Remove Duplicates |
| Sliding Window | Subarray problems | Maximum Sum Subarray, Longest Substring |
| Fast-Slow Pointer | Cycle detection, Middle element | Detect Cycle in Linked List |
📦 Data Structures
-
✅ Arrays
- Array operations (insertion, deletion, traversal)
- Searching and sorting
- Rotation problems
- Subarray problems
-
✅ Linked Lists
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Reversal techniques
- Cycle detection
-
✅ Stacks
- Array-based implementation
- Linked List-based implementation
- Expression evaluation
- Parentheses matching
-
✅ Queues
- Simple Queue
- Circular Queue
- Priority Queue
- Deque (Double-ended Queue)
-
✅ Trees
- Binary Tree
- Binary Search Tree (BST)
- Tree traversals (Inorder, Preorder, Postorder, Level Order)
- AVL Tree
- Heap
-
✅ Graphs
- Graph representations
- BFS and DFS traversals
- Shortest path algorithms
- Minimum spanning tree
-
✅ Strings
- String manipulation
- Pattern matching (KMP, Rabin-Karp)
- String reversal and rotation
🧮 Algorithms
- Searching: Linear Search, Binary Search
- Sorting: Bubble, Selection, Insertion, Merge, Quick, Heap Sort
- Graph Algorithms: BFS, DFS, Dijkstra's, Bellman-Ford
- Pattern Matching: KMP, Rabin-Karp
- Dynamic Programming: Coming soon
- Greedy Algorithms: Coming soon
🎯 DSA Patterns
- Two Pointer Technique
- Sliding Window
- Fast and Slow Pointers
- More patterns coming soon...
Soumen Sen
GitHub: @soumensen411