/dsa-with-c

Implementing Data structures and algorithms in c

Primary LanguageCMIT LicenseMIT

Data Structures and Algorithms in C

Implementing Data structures and algorithms in C programming language

Visualize DSA

Visit Visualize DSA to visualize the data structures and algorithms.

Data Structures

  • Stack
  • Queue
    • Circular Array Queue
    • Linked List Queue
  • Linked List
    • Singly Linked List
    • Doubly Linked List
  • Binary Tree
    • Creating
    • Inserting
    • Traversing
      • Preorder
      • Inorder
      • Postorder
      • Levelorder
  • Binary Search Tree
    • Creating
    • Inserting
    • Deleting
    • Searching
  • Heap
  • Hashing
  • Graphs
  • Trie
  • Segment Tree
  • Suffix Array
  • Suffix Tree
  • AVL Tree
  • Red Black Tree
  • B Tree
  • B+ Tree
  • K Dimensional Tree
  • Disjoint Set
  • Fenwick Tree
  • Sparse Table

Algorithms

  • Sorting

    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Quick Sort
    • Heap Sort
    • Counting Sort
    • Radix Sort
    • Bucket Sort
  • Searching

    • Linear Search
    • Binary Search
    • Ternary Search
    • Jump Search
    • Interpolation Search
    • Exponential Search
  • Graphs

    • Breadth First Search
    • Depth First Search
    • Dijkstra's Algorithm
    • Bellman Ford Algorithm
  • Dynamic Programming

    • 0-1 Knapsack Problem
    • Longest Common Subsequence
    • Matrix Chain Multiplication
    • Edit Distance
    • Longest Increasing Subsequence
    • Coin Change
    • Subset Sum
    • Bitmasking
    • All Pair Shortest Path
    • Travelling Salesman Problem
    • Maximum Sum Increasing Subsequence
    • Maximum Sum Rectangle in a 2D Matrix
    • Longest Bitonic Subsequence
    • Floyd Warshall Algorithm
    • Palindrome Partitioning
    • Box Stacking
    • Cutting a Rod
  • Backtracking

    • N Queens Problem
    • Sudoku Solver
    • Rat in a Maze
    • Word Break (Print all ways)
    • M Coloring Problem
    • Hamiltonian Cycle
    • Knight's Tour
    • Cryptarithmetic
  • Greedy

    • Fractional Knapsack Problem
    • Job Sequencing Problem
    • Minimum Spanning Tree
    • Huffman Coding
    • Activity Selection Problem
    • Prim's Algorithm
    • Kruskal's Algorithm
    • Graph Coloring Problem

Testing

To test the code, run the following commands:

# Compile
make build

# Run tests
./dsa

# Clean up
make clean

Usage

./dsa test_name_regex

Examples

./dsa test_stack
./dsa test_queue
./dsa test_linked_list