This repository contains implementations of various Data Structures and Algorithms in C++. It is aimed at providing a structured approach to understanding and implementing core DSA concepts, useful for interview preparation and competitive programming.
This project is a collection of common Data Structures and Algorithms implemented in C++. Each data structure and algorithm is well-documented, with examples to help you understand how to use them.
It is designed for students, developers, and anyone looking to sharpen their problem-solving skills in C++.
- Arrays
- Operations: Insertion, Deletion, Searching
- Linked List
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Stacks
- Operations: Push, Pop, Peek
- Queues
- Circular Queue, Deque (Double-Ended Queue)
- Priority Queue
- Trees
- Binary Tree
- Binary Search Tree (BST)
- AVL Tree
- Heap (Min Heap, Max Heap)
- Graphs
- Adjacency Matrix and List Representation
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Linear Search
- Binary Search
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
Make sure you have Git and a C++ compiler installed on your system.
-
Clone the repository using the following command:
git clone https://github.com/mohAhmadRaza/DSA-CPP.git
-
Navigate to the project directory:
cd DSA-CPP
-
Compile the C++ files using a C++ compiler (e.g.,
g++
):g++ filename.cpp -o output
-
Run the executable:
./output
Each folder inside this repository contains the following:
- Code: The actual C++ code implementing the data structure or algorithm.
- Example: An example or test case demonstrating how to use the code.
To run an example of a binary search algorithm:
- Navigate to the binary search directory.
- Compile and run the code:
g++ binary_search.cpp -o binary_search ./binary_search
Contributions are welcome! Feel free to open a pull request if you want to add new algorithms, optimize existing code, or fix any issues.
To contribute:
- Fork this repository.
- Create a new branch:
git checkout -b my-feature-branch
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-feature-branch
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Thanks to all the resources, tutorials, and community support that made this project possible.