Skip to content

eashwaranRaghu/Data-Structures-and-Algorithms

Repository files navigation

Data structures and algorithms for interviews

This repository contains C++ implementations of general algorithms and data structures.

For a quick revision checkout the readme files for each topic.

Contents

  1. Algorithm analysis
    • Solving recurrences
      • Iteration Method
      • Substitution Method
      • Recurrence Tree Method
      • Master Method
    • Amortized Analysis
  2. Searching, Sorting and Order Statistics Readme
    1. Searching
    2. Sorting
    3. Order Statistics
  3. Algorithmic Paradigms
    1. Complete Search
    2. Divide and Conquer
      • Strassen's algorithm for matrix multiplication
    3. Dynamic programming
    4. Greedy algorithm
      • Task Scheduling
      • Max contiguous subvector sum
      • Invariants
      • Huffman encoding
      • Matroid
      • Activity Selection
      • Fractional Knapsack
  4. Trees Readme
  5. Graph theory
  6. Math
    1. Combinatorics
      • Computation of binomial coefficients
      • Pigeon-hole principle
      • Inclusion/exclusion
      • Catalan number
      • Pick's theorem
    2. Number theory
      • Integer parts
      • Divisibility
      • Euclidean algorithm
      • Modular arithmetic
        • Modular multiplication
        • Modular inverses
        • Modular exponentiation by squaring
      • Chinese remainder theorem
      • Fermat's little theorem
      • Euler's theorem
      • Phi function
      • Frobenius number
      • Quadratic reciprocity
      • Pollard-Rho
      • Miller-Rabin
      • Hensel lifting
      • Vieta root jumping
    3. Game theory
      • Combinatorial games
      • Game trees
      • Mini-max
      • Nim
      • Games on graphs
      • Games on graphs with loops
      • Grundy numbers
      • Bipartite games without repetition
      • General games without repetition
      • Alpha-beta pruning
    4. Numerical methods
      • Numeric integration
      • Newton's method
      • Root-finding with binary/ternary search
      • Golden section search
    5. Matrices
      • Gaussian elimination
      • Exponentiation by squaring
  7. Geometry
    • Coordinates and vectors
      • Cross product
      • Scalar product
    • Convex hull
    • Polygon cut
    • Closest pair
    • Coordinate-compression
    • Quadtrees
    • KD-trees
    • All segment-segment intersection
  8. Strings
    • Knuth-Morris-Pratt
    • Rabin Karp
    • Tries
    • Rolling polynomial hashes
    • Suffix array
    • Suffix tree
    • Aho-Corasick
    • Manacher's algorithm
    • Letter position lists
  9. Others
    • Combinatorial search
      • Meet in the middle
      • Brute-force with pruning
      • Best-first (A*)
      • Bidirectional search
      • Iterative deepening DFS / A*
      • MiniMax
    • Sweeping
      • Discretization (convert to events and sweep)
      • Angle sweeping
      • Line sweeping
      • Discrete second derivatives
    • Data structures related
      • LCA (2^k-jumps in trees in general)
      • Pull/push-technique on trees
      • Heavy-light decomposition
      • Centroid decomposition
      • Lazy propagation
      • Self-balancing trees
      • Convex hull trick (wcipeg.com/wiki/Convex_hull_trick)
      • Monotone queues / monotone stacks / sliding queues
      • Sliding queue using 2 stacks
      • Persistent segment tree
    • Travelling salseman
    • Sliding window
    • 2 pointers
    • Fast & slow pointers
    • Merge interval
    • Cyclic Sort
    • 2 Heaps
    • K-way merge
    • Minimax
    • Line sweep
    • Rolling Hash
    • Reservoir sampling
    • Rejection sampling
    • Scan Line
    • Matrix fast exponentiation
    • Repeated squaring
    • Euler's Theorem
    • Fermat's Little theorem
    • Shunting yard algorithm: expression parsing
    • LRU caching