This repository contains robust implementations of fundamental data structures in C++, along with solutions to real-world scenario problems and practice questions curated from various competitive programming platforms and academic sources.
Note: Problem solutions do not include the full data structure implementations. To run them, you must download the required header files from the Implementations section or folder and save them in the same directory as the solution file. The solutions are pre-linked to these files via #include statements.
Use the links below to jump to specific files:
Core data structures implemented from scratch.
- Stack using Array
- Stack using linked list
- Shifted Queue using Array
- Circular Queue using Array
- Queue using linked list
- Singly Linked List using head pointer only
- Singly circular Linked List using tail pointer only
- Singly Linked List using both head and tail pointer
- Doubly Linked List using both head and tail pointer
- Doubly Linked List using head pointer only
- Doubly circular Linked List using tail pointer only
- Binary Search Tree
| Problem Link | Description | Category |
|---|---|---|
| Maze-Escape | Find a path out of a grid-based maze | Scenario based Question |
| Next greater element | Find the first greater element to the right for each array element | Scenario based Question |
| Infix to pre and post fix conversion | Convert standard infix expressions to prefix and postfix notations | Practice Questions |
| Reverse Stack | Reverse the elements of a stack using recursion or auxiliary space | Practice Questions |
| Problem Link | Description | Category |
|---|---|---|
| TotalSum of min+max in SlidingWindow | Calculate the sum of minimum and maximum elements in every subarray of size k | Scenario based Question |
| Problem Link | Description | Category |
|---|---|---|
| Multiplayer board game implementation | Implement the simple game mechanics using doublyLL (based on both pointers) | Scenario based Question |
| Song playlist manager | Implement the song playlist manager using DoublyLL (based on both pointers) | Scenario based Question |
| Movie watchList manager | Implement the movie watchlist manager using DoublyLL (based on both pointers) | Scenario based Question |
| DeleteNode in O1 | code a global function which removes node from the linked list in O1 time complexity | Practice problem |
| PalindromeList using stack | code a global function which finds the LL is palindrome uising stack and given LL | Practice problem |
| Problem Link | Description | Category |
|---|---|---|
| String reverse recursively | Reverse a string without using loops | Practice Question |
| Palindrome recursively | Check if a string reads the same backward as forward using recursion | Practice Questions |
| LCM of numbers | Find the Least Common Multiple of an array of numbers recursively | Practice Questions |
| Factorial | Compute the factorial of a given number using a recursive base case | Practice Questions |
| StairsClimb | Count the distinct ways to reach the top of a staircase | Scenario based Questions |
| Maze escape recursively | Solve a maze problem pathfinder logic using recursion back-tracking | Scenario based Questions |
| Print LinkedList recursively | Traverse and display linked list elements using recursive calls | Practice Question |
Contributions are welcome! If you want to add a new data structure or any practice question follow the given steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-new-solution). - Commit your changes (
git commit -m 'Add new DS solution'). - Push to the branch (
git push origin feature-new-solution). - Open a Pull Request.
If there is any bug supported, please report it! You can do this by:
- Navigating to the Issues tab.
- Clicking on New Issue.
- Describing the bug and providing the code snippet where it occurs.