Summary of common/frequent test algorithms

Source: Internet
Author: User

Transfer from TANGJZ Blog ... Basic algorithm



    1. Breadth First search (BFS)
    2. Optimization: two-way BFS
    3. Depth-First search (DFS)
    4. Optimization: Binary DFS
    5. Iterative deepening Search (IDS)
    6. Heuristic Search (Astar)
    7. Optimization: Idastar
    8. Optimization: pruning, bitwise arithmetic


    1. Bubble sort/Select sort
    2. Cardinal Sort/Bucket sort
    3. Count sort
    4. Insert Sort/Hill Sort
    5. Quick Sort
    6. Merge sort/Find inverse logarithm
    7. Heap Sort


Divide and conquer

    1. Split/three Min/n
    2. CDQ Divided treatment


Discretization of

Two-point answer

Fast Power/decimal fast Power

Basic mathematics

Sum of series

Taylor unfold


    1. Matrix multiplication
    2. Gaussian elimination element
    3. Judging linear correlation

Number of Catalan

Combinatorial mathematics

    1. Addition principle/multiplication principle
    2. Combined number recursion/Yang Hui triangle
    3. Two-term theorem
    4. Drawer principle/pigeon cage principle
    5. Lucas theorem
    6. Principle of tolerance and repulsion

/miller-rabin test of prime number determination

Decomposition factorization/ask for approximate

Euclidean algorithm/Euclidean method

Extended Euclidean algorithm/multiplicative inverse/Two-element one-time congruence equation

Linear preprocessing 1-n multiplication inverse element

Prime sieve

    1. Eratosthenes Sieve
    2. Euler sieve

Euler functions

Möbius function

Fermat theorem

Wilson's theorem

Chinese remainder theorem/grandson theorem

Two times remaining/cipolla ' s algorithm

Original root

Discrete logarithm/baby-step giant-step

Group theory


Burnside lemma

Polya theorem

Dynamic planning

Backpack DP

    1. 01 Backpack
    2. Full backpack
    3. Multiple backpack
    4. Mixed backpack
    5. Two-dimensional backpack
    6. Group Backpack
    7. Tree-shaped backpack
    8. Generic backpack

by dimension

    1. Linear DP
    2. Interval DP
    3. High-dimensional DP

By type

    1. Divide DP
    2. Longest ascending subsequence (LIS)
    3. Longest common sub-sequence (LCS)
    4. DP on a directed acyclic graph (DAG)
    5. (Connectivity-based) state compression DP


    1. Scrolling array
    2. Prefixes and
    3. Quadrilateral inequalities
    4. Slope optimization
    5. Bit arithmetic
    6. Data
    7. CDQ Divided treatment


    1. Memory Search
    2. Shun Push/Reverse push
    3. Minimal notation
Graph theory

Connectivity of

    1. The traversal of graphs
    2. Topological sorting
    3. Strong Unicom Component
    4. /tarjan algorithm of Cutting point, bridge and double-link component


    1. Recent public ancestor (LCA)/tarjan algorithm
    2. The Center/diameter of the tree
    3. The center of the tree
    4. Isomorphism of Trees

Shortest circuit

    1. Multi-source Shortest path (APSP)/floyd
    2. Minimum ring
    3. Transitive closures
    4. Single Source Shortest path (SSSP)/queue+bellman-ford/heap+dijkstra

Spanning tree

    1. Minimum spanning tree
    2. Minimum scale spanning tree
    3. Minimum bottleneck tree

Two-part diagram

    1. Two-part diagram verification
    2. Two-part graph dyeing
    3. Max match/Hungarian algorithm
    4. Optimal matching/km algorithm

Network flow

    1. Dinic algorithm
    2. ISAP algorithm
    3. Pre-flow propulsion algorithm
    4. Tip: Break a point
    5. Optimization: Close/close Edge
    6. Optimization: Line segment Tree

High precision

    1. High precision subtraction for low precision
    2. High precision subtraction for high precision
    3. Optimization: Fast Fourier transform

Linked list

    1. Single doubly linked list
    2. Block Linked list
    3. adjacency Table/Benzi



    1. Loop queue
    2. Priority queue/Minimum binary heap
    3. Left-leaning tree
    4. Fibonacci Heap


    1. Binary search Tree
    2. Heap (IBID.)
    3. Flute Karlshu
    4. Tree-like array
    5. Segment Tree
    6. Expansion: Dynamic segment tree, four-point tree
    7. Weight Balance Tree
    8. Stretching tree

and check Set

Hash table (hash)



    1. Trie Tree
    2. Kmp
    3. Manacher
    4. AC Automaton (Aho-corasick automaton)
    5. Suffix array/suffix tree/suffix automaton/suffix balance tree, etc.

Dynamic tree

    1. Tree chain split/tree block split
    2. Link-cut Tree/euler-tour Tree
Calculate geometry

Plane geometry/geometric/analytic geometry/parametric equations

Determining point-to-polygon relationship (corner method/Scan line method)

Polygon Area intersection/area and

Polar sort

Convex hull/Rotating jam

Semi-planar Cross

Triangulation of/voronoi diagram

Game theory

SG Combo Game/sg function

Bash games/wythoff Games/nim Games

Fight Search

Probability theory

Full probability

Bayes theorem

Markov process

Chebyshev theorem



Random adjustment/Simulated annealing/random mountain climbing

Simplex method

Summary of common/frequent test algorithms

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.