Skip to content

This repository contains a comprehensive collection of Data Structures and Algorithms (DSA) programs written in C++. It serves as a personal reference, learning resource, and preparation material for exploring the field of programming and concepts of technology.

Notifications You must be signed in to change notification settings

mrkshreyash/data-structures-and-algorithms-in-cpp

Repository files navigation

Data Structures & Algorithms in C++

Original Repository: mrkshreyash/data-structures-and-algorithms-in-cpp

Overview

This project is a collection of fundamental Data Structures and Algorithms (DSA) implemented in C++. It aims to provide educational, beginner-friendly code examples of widely-used concepts like:

  • Recursion (e.g., Fibonacci, Factorial, Tower of Hanoi)
  • Linked Lists (Singly, Doubly, Circular)
  • Stacks (Array-based, Linked List-based)

The project is ideal for:

  • DSA learners looking to explore implementation from scratch.
  • Developers preparing for technical interviews.
  • Contributors interested in extending functionality or improving readability.

Installation & Setup

  1. Clone the repository
git clone https://github.com/mrkshreyash/data-structures-and-algorithms-in-cpp.git
cd data-structures-and-algorithms-in-cpp
  1. Environment & Dependencies
  • A C++ compiler like g++ or any IDE (e.g., Code::Blocks, Dev C++, VS Code)
  • Recommended: C++11 or higher for compatibility
  • No external libraries are required — all programs use standard C++
  • No external libraries required

Topic-wise Content

No. File Description
1 Fibonacci series.cpp Implements a recursive function to calculate the Nth Fibonacci number. Useful for understanding how recursion handles repeated calculations and grows with time complexity.
2 Factorial.cpp A basic example of recursion in mathematics: calculates factorial (n!) by multiplying n * (n-1) * (n-2)... until 1. Great intro to base and recursive cases.
3 Tower of Hanoi.cpp Classic problem used to teach recursion and problem breakdown: move disks between rods following strict rules. This file shows the logic to solve it recursively and print each move.

No. File Description
1 Singlylinkedlist.cpp Implements a singly linked list with operations like insertion, deletion, and traversal. Each node has one pointer (to next node). Good for basic memory management.
2 Doublylinkedlist.cpp Implements a doubly linked list, where each node has two pointers — one to the next and one to the previous. Allows bidirectional traversal, and easier deletion.
3 Circularlinkedlist.cpp Demonstrates a circular linked list where the last node points back to the first, forming a loop. Includes insertion and deletion at various positions. Used in buffering, round-robin scheduling, etc.

No. File Description
1 Simplearraybasedstack.cpp Implements a stack using a fixed-size array. Covers push(), pop(), peek() operations. Great for learning the basics of stack behavior and overflow/underflow conditions.
2 Dynamicarraybasedstack.cpp Uses C++ STL vectors to create a stack that grows as needed (no size limit). This file shows how to handle stack operations using built-in dynamic memory features.
3 Linkedlistbasedstack.cpp Builds a stack using linked list nodes. Each push operation adds a new node to the top; pop removes it. Helps you understand how dynamic memory management works without arrays.

No. File Description
1 SimpleCircularQueue.cpp Circular queue with fixed array size.
2 DynamicCircularQueue.cpp Dynamically resizing circular queue using vector.
3 LinkedListQueue.cpp Queue implemented with linked list (front-rear).

No. File Description
1 BinaryTreeTraversal.cpp Builds a binary tree using user input and supports
Preorder, Inorder, and Postorder traversals.

Contributing Guidelines

We welcome contributions from developers and learners alike!

How to Contribute

  • Fork the repository and clone it to your machine
  • Create a new branch for your feature or fix
  • Follow the existing naming and commenting conventions
  • Make your changes and commit them with meaningful messages.
  • Push and open a Pull Request with a clear description of your contribution

Code Standards

  • Use meaningful variable/function names
  • Keep your code modular and well-commented
  • Ensure your code compiles without errors

Example Pull Request

  • Title: Added Circular Queue Implementation in C++
  • Description: Implements circular queue using arrays under Chapter 05 - Queues. Fixes issue #4

Acknowledgements

Thanks to the owner of this repository and future contributors!
This project is inspired by the need for clean, beginner-friendly C++ examples of core data structures.

About

This repository contains a comprehensive collection of Data Structures and Algorithms (DSA) programs written in C++. It serves as a personal reference, learning resource, and preparation material for exploring the field of programming and concepts of technology.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages