Skip to content

Latest commit

 

History

History
141 lines (102 loc) · 3.21 KB

README.md

File metadata and controls

141 lines (102 loc) · 3.21 KB

DSA in C++

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.

Table of Contents


  1. Introduction
  2. Data Structures
  3. Algorithms
  4. Installation & Setup
  5. How to Use
  6. Contributing
  7. License

Introduction

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++.


Data Structures

1. Linear Data Structures

  • 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

2. Non-Linear Data Structures

  • 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)

Algorithms

1. Sorting Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort

2. Searching Algorithms

  • Linear Search
  • Binary Search
  • Depth-First Search (DFS)
  • Breadth-First Search (BFS)

Installation & Setup

Prerequisites

Make sure you have Git and a C++ compiler installed on your system.

  1. Clone the repository using the following command:

    git clone https://github.com/mohAhmadRaza/DSA-CPP.git
  2. Navigate to the project directory:

    cd DSA-CPP
  3. Compile the C++ files using a C++ compiler (e.g., g++):

    g++ filename.cpp -o output
  4. Run the executable:

    ./output

How to Use

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.

Example

To run an example of a binary search algorithm:

  1. Navigate to the binary search directory.
  2. Compile and run the code:
    g++ binary_search.cpp -o binary_search
    ./binary_search

Contributing

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:

  1. Fork this repository.
  2. Create a new branch: git checkout -b my-feature-branch
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-feature-branch
  5. Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

Thanks to all the resources, tutorials, and community support that made this project possible.