Skip to content

rain1024/datastructures-algorithms-competitive-programming

Repository files navigation

Data Structures & Algorithms
Competitive Programming

 <Hello!>
-|DaS.Algo|-
+Pr0bl3m5!
`Comp::Ete`
{Solve~Fun}
 ^Join_us^

Programming Languages:
Python, C++, Java, Typescript


New Version 1.3.0 is released.

⚛ Introduction

📑 Data Structures

A data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More recisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

B - Basic, A - Advanced

👾 Algorithms

An algorithm is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation.

B - Basic, A - Advanced

📦 Algorithms by Topic

  • Big-O
  • Math
    • B Bit Manipulation cpp🐀 py🐍
    • B Binary Floating Point
    • B Factorial
    • B Fibonacci Number
    • B Prime Factors
    • B Primality Test
    • B Euclidean Algorithm
    • B Least Common Multiple
    • B Sieve of Eratosthenes
    • B Is Power of Two
    • B Pascal's Triangle
    • B Complex Number
    • B Radian & Degree
    • B Fast Powering
    • B Horner's method
    • B Matrices
    • B Euclidean Distance
    • A Integer Partition
    • A Square Root
    • A Liu Hui π Algorithm
    • A Discrete Fourier Transform
  • Sets
    • B Cartesian Product
    • B Fisher–Yates Shuffle
    • A Power Set
    • A Permutations
    • A Combinations
    • A Longest Common Subsequence
    • A Longest Increasing Subsequence
    • A Shortest Common Supersequence
    • A Knapsack Problem
    • A Maximum Subarray
    • A Combination Sum
  • Strings
    • B Hamming Distance
    • B Palindrome
    • A Levenshtein Distance
    • A Knuth–Morris–Pratt Algorithm
    • A Z Algorithm
    • A Rabin Karp Algorithm
    • A Longest Common Substring
    • A Regular Expression Matching
  • Searches py🐍
    • B Linear Search
    • B Jump Search
    • B Binary Search
    • B Interpolation Search
  • Sorting cpp🐀 py🐍
    • B Bubble Sort
    • B Selection Sort
    • B Insertion Sort
    • B Heap Sort
    • B Merge Sort
    • B Quicksort
    • B Shellsort
    • B Counting Sort
    • B Radix Sort
  • Two Pointers
  • Linked Lists
    • B Straight Traversal
    • B Reverse Traversal
  • Trees
    • B Depth-First Search (DFS)
    • B Breadth-First Search (BFS)
  • Graphs
    • B Depth-First Search (DFS)
    • B Breadth-First Search (BFS)
    • B Kruskal’s Algorithm
    • A Dijkstra Algorithm
    • A Bellman-Ford Algorithm
    • A Floyd-Warshall Algorithm
    • A Detect Cycle
    • A Prim’s Algorithm
    • A Topological Sorting
    • A Articulation Points
    • A Bridges - DFS based algorithm
    • A Eulerian Path and Eulerian Circuit - Fleury's algorithm - Visit every edge exactly once
    • A Hamiltonian Cycle - Visit every vertex exactly once
    • A Strongly Connected Components - Kosaraju's algorithm
    • A Travelling Salesman Problem - shortest possible route that visits each city and returns to the origin city
  • Cryptography
    • B Polynomial Hash - rolling hash function based on polynomial
    • B Rail Fence Cipher - a transposition cipher algorithm for encoding messages
    • B Caesar Cipher - simple substitution cipher
    • B Hill Cipher - substitution cipher based on linear algebra
  • Machine Learning
    • B NanoNeuron - 7 simple JS functions that illustrate how machines can actually learn (forward/backward propagation)
    • B k-NN - k-nearest neighbors classification algorithm
    • B k-Means - k-Means clustering algorithm
  • Image Processing
    • B Seam Carving - content-aware image resizing algorithm
  • Statistics
    • B Weighted Random - select the random item from the list based on items' weights
  • Evolutionary algorithms
    • A Genetic algorithm - example of how the genetic algorithm may be applied for training the self-parking cars
  • Uncategorized
    • B Tower of Hanoi
    • B Square Matrix Rotation - in-place algorithm
    • B Jump Game - backtracking, dynamic programming (top-down + bottom-up) and greedy examples
    • B Unique Paths - backtracking, dynamic programming and Pascal's Triangle based examples
    • B Rain Terraces - trapping rain water problem (dynamic programming and brute force versions)
    • B Recursive Staircase - count the number of ways to reach to the top (4 solutions)
    • B Best Time To Buy Sell Stocks - divide and conquer and one-pass examples
    • A N-Queens Problem
    • A Knight's Tour

💠 Algorithms by Paradigm

  • Brute Force - look at all the possibilities and selects the best solution cpp🐀 py🐍
    • B Linear Search
    • B Rain Terraces - trapping rain water problem
    • B Recursive Staircase - count the number of ways to reach to the top
    • A Maximum Subarray
    • A Travelling Salesman Problem - shortest possible route that visits each city and returns to the origin city
    • A Discrete Fourier Transform - decompose a function of time (a signal) into the frequencies that make it up
  • Greedy - make the locally optimal choice at each stage with the hope of finding a global optimum py🐍
    • B Jump Game
    • A Unbound Knapsack Problem
    • A Dijkstra Algorithm - finding the shortest path to all graph vertices
    • A Prim’s Algorithm - finding Minimum Spanning Tree (MST) for weighted undirected graph
    • A Kruskal’s Algorithm - finding Minimum Spanning Tree (MST) for weighted undirected graph
  • Divide and Conquer - divide the problem into a number of subproblems that are smaller instances of the same problem
    • B Binary Search
    • B Tower of Hanoi
    • B Pascal's Triangle
    • B Euclidean Algorithm - calculate the Greatest Common Divisor (GCD)
    • B Merge Sort
    • B Quicksort
    • B Tree Depth-First Search (DFS)
    • B Graph Depth-First Search (DFS)
    • B Matrices - generating and traversing the matrices of different shapes
    • B Jump Game
    • B Fast Powering
    • B Best Time To Buy Sell Stocks - divide and conquer and one-pass examples
    • A Permutations (with and without repetitions)
    • A Combinations (with and without repetitions)
    • A Maximum Subarray
  • Dynamic Programming - break the problem into subproblems and store the results of subproblems to avoid computing the same results again (basic: cpp🐀, intermidate: cpp🐀)
    • B Fibonacci Number
    • B Jump Game
    • B Unique Paths
    • B Rain Terraces - trapping rain water problem
    • B Recursive Staircase - count the number of ways to reach to the top
    • B Seam Carving - content-aware image resizing algorithm
    • A Levenshtein Distance - minimum edit distance between two sequences
    • A Longest Common Subsequence (LCS)
    • A Longest Common Substring
    • A Longest Increasing Subsequence
    • A Shortest Common Supersequence
    • A 0/1 Knapsack Problem
    • A Integer Partition
    • A Maximum Subarray
    • A Bellman-Ford Algorithm - finding the shortest path to all graph vertices
    • A Floyd-Warshall Algorithm - find the shortest paths between all pairs of vertices
    • A Regular Expression Matching
  • Backtracking - similarly to brute force, try to generate all possible solutions, but each time you generate next solution you test if it satisfies all conditions, and only then continue generating subsequent solutions. Otherwise, backtrack, and go on a different path of finding a solution. Normally the DFS traversal of state-space is being used.
    • B Jump Game
    • B Unique Paths
    • B Power Set - all subsets of a set
    • A Hamiltonian Cycle - Visit every vertex exactly once
    • A N-Queens Problem
    • A Knight's Tour
    • A Combination Sum - find all combinations that form specific sum
  • Branch & Bound remember the lowest-cost solution found at each stage of the backtracking search, and use the cost of the lowest-cost solution found so far as a lower bound on the cost of a least-cost solution to the problem, in order to discard partial solutions with costs larger than the lowest-cost solution found so far. Normally BFS traversal in combination with DFS traversal of state-space tree is being used.

🔆 Collections

Competitive Programming Events

  • 🎄 Advent of Code (2015, 2022)
  • 🔰 Google Code Jam (2022)

Coding Problems Website

Courses & Specialization

Contributors

This project exists thanks to all the people who contributed.