Skip to content

Latest commit

 

History

History
87 lines (51 loc) · 2.49 KB

README.md

File metadata and controls

87 lines (51 loc) · 2.49 KB

A list of useful snippets (Personal-use only)

The material in this repo are for

  • revising basics

  • Trying new(mainly C++ 17, 20) features

  • some auxiliary prototypes for various work project

Algorithms and Strategies

Path finding

Dynamic Programming

Dynamic Programming is similar to backtracking except that we stop making redundant computations (i.e. Memoization. Calculate the answer to each subproblem only once)

Backtracking

The algorithm begins with anempty solution and extends the solution step by step. The search recursively goes through all different ways how a solution can be constructed. climb-stairs

(https://gcc.godbolt.org/z/aK8jzT)

NQueens

Find a way to place n queens on an nxn chessboard so that no two queens are attacking each other.

NQueens by recursion

Graph algorithms

Dijkstra's SSSP

topological sort using indegrees

Branch and Bound

BB is an optimization algorithm converts a maximization into a minimization problem.

Brute-force branch and bound

Data structures

Finite Difference with functor

C++ general