Skip to content

This repository provides a comprehensive collection of C and C++ code examples covering advanced data structures and algorithms concepts. It includes practical demonstrations of linked lists, stacks, queues, recursion, pointers, object-oriented programming, and more, ideal for learning and teaching DSA.

Notifications You must be signed in to change notification settings

jagratadeb/LearnDSA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

LearnDSA

GitHub last commit wakatime C++

Project Overview

LearnDSA is a comprehensive collection of code examples, notes, and patterns designed to help learners and developers master Data Structures and Algorithms (DSA) using C and C++. The repository is organized by topic, covering fundamental concepts, advanced techniques, and practical coding patterns. It serves as a reference and practice resource for students, educators, and professionals preparing for technical interviews or deepening their understanding of DSA.

Directory and File Structure

Below is an organized overview of the repository's structure, with brief descriptions for each folder:

01 Basic Concepts/

  • Purpose: Foundational programming concepts in C/C++.
    • 01 For Each Loop: Demonstrates the use of for-each loops in C++ for iterating over collections.
    • 02 Structures: Introduction to user-defined data types using structures in C.
    • 03 Pointers: Basics of pointers, pointer arithmetic, and pointers with structures in C.
    • 04 Reference: Reference variables and their usage in C++ for efficient memory access.
    • 05 Functions: Function concepts including arrays as parameters, modular vs. monolithic code, parameter passing, and functions with structures.
    • 06 Object Orientation: Stepwise examples illustrating object-oriented programming concepts in C++ (classes, objects, encapsulation, etc.).
    • 07 Patterns: C++ programs for various pattern printing problems (rectangles, pyramids, diamonds, triangles, and more).

02 Main Concepts/

  • Purpose: Core DSA topics and advanced programming techniques.
    • 01 Recursion: Recursion basics, factorial, Fibonacci series, and recursive algorithms.
    • 02 Array Basics: Array declaration, memory layout, static/dynamic allocation, and 2D arrays in C/C++.
    • 03 Array ADT: Array Abstract Data Type operations—creation, modification, searching, analysis, rearrangement, set operations, and menu-driven programs (organized by subfolder).
    • 04 Strings: String declaration, manipulation, validation, reversal, comparison, palindrome checks, and more.
    • 05 Matrix: Matrix operations such as addition, subtraction, multiplication, and transposition.
    • 06 Polynomials: Implementation of polynomial data structures and algorithms for polynomial addition, multiplication, and evaluation.
    • 07 Linked List: Singly and doubly (both circular and linear) linked list implementations, including insertion, deletion, traversal, and common linked list algorithms.
    • 08 Stack: Stack data structure implementation using arrays and linked lists, including operations like push, pop, and stack applications (e.g., expression evaluation).
    • 09 Queue: Queue data structure implementation using arrays and linked lists, including operations like enqueue, dequeue, and circular queue applications.
    • 10 Trees: Binary tree implementation, traversal algorithms (in-order, pre-order, post-order), and binary search tree operations (insertion, deletion, searching).
    • 11 Heap: To be added soon.
    • 12 Sorting Techniques: To be added soon.
    • 13 Graphs: To be added soon.
    • 14 Divide and Conquer: Introduction to divide and conquer algorithms, including merge sort, quick sort, max min, and binary search.
    • 15 Greedy Methods: Introduction to greedy algorithms, including activity selection, Huffman coding, and minimum spanning trees.
    • More advanced topics like Graphs, Hashing, Heaps and Dynamic Programming will be added in future.

How to Use This Repository

Prerequisites

  • Compiler: GCC (MinGW recommended for Windows) for C/C++ code.
  • Editor: Visual Studio Code or any C/C++ compatible IDE.

Setup Instructions

  1. Clone the repository:
    git clone https://github.com/jagratadeb/LearnDSA.git
  2. Navigate to the project directory:
    cd LearnDSA
  3. Open in VS Code (optional):
    code .

Building and Running Code

  • C++ Files:

    • You can run the following command in the terminal:

      g++ <filename.cpp> -o <output.exe>
    • Then execute the compiled program:

      ./<output.exe>
  • C Files:

    • You can run the following command in the terminal:

      gcc <filename.c> -o <output.exe>
    • Then execute the compiled program:

      ./<output.exe>

Example Commands

Language Compile Run
C++ g++ hello.cpp -o hello ./hello
C gcc hello.c -o hello ./hello

Contributing

  • Fork the repository and create a new branch for your code improvements or additions.
  • New codes will not be accepted (only simplifications and improvements are allowed).
  • Follow the existing structure for adding new code.
  • Add your code or documentation in the appropriate folder.
  • Ensure code is well-commented and follows the existing structure.
  • Submit a pull request with a clear description of your changes.

Maintainer

Jagrata Deb


Feel free to explore, learn, and contribute (check out contribution guidelines) to this repository!

About

This repository provides a comprehensive collection of C and C++ code examples covering advanced data structures and algorithms concepts. It includes practical demonstrations of linked lists, stacks, queues, recursion, pointers, object-oriented programming, and more, ideal for learning and teaching DSA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published