Sandomhet
Samuel (Shaojia) Zhang
Samuel (Shaojia) Zhang
Sandom

Programming Knowledge

58 entries

Competitive programming notes, algorithm write ups and reusable C++ templates, most of them written while training for ICPC.

Templates

ICPC Templates

Printable ICPC C++ templates ordered by priority, with the minimum notes needed to recall each one.

Graph

Network Flow Problem

maximum flow problem, minimum-cost flow problem

Polynomial

Fast Fourier Transform (FFT)

FFT is an efficient algorithm for computing the Discrete Fourier Transform (DFT) and its inverse, which has applications in polynomial multiplication, signal processing, and more.

Dynamic Programming

Knapsack DP

DP for the knapsack problem, including 0-1, complete, and multiple knapsack variations.

Dynamic Programming

Longest Common Subsequence/Substring (LCS)

Dynamic Programming

Longest Increasing Subsequence (LIS)

Templates

C++ STL Containers Cheat Sheet

Data Structures

Hash Table

Data structure for efficient key-value mapping.

Miscellaneous

Sorting Algorithms

An overview of various sorting algorithms, their time and space complexities, and stability.

Data Structures

Disjoint Set Union / Union-Find

stores a partition of a set into disjoint subsets.

Graph

Minimum Spanning Tree (MST)

a subset of the edges of a connected, edge-weighted undirected graph that connects all the vertices together, without any cycles and with the minimum possible total edge weight.

Graph

Shortest Path Problem

finding a path between two vertices in a graph such that the sum of the weights of its constituent edges is minimized.

Graph

Connected Components and Strongly Connected Components

Finding connected components and strongly connected components in graphs.

Miscellaneous

Divide and Conquer

recursively breaks down a problem into two or more sub-problems of the same or related type, until these become simple enough to be solved directly.

Graph

2-SAT

Satisfiability of boolean formulas with 2 literals per clause

Graph

Graph Traversal

Depth First Search (DFS) and Breadth First Search (BFS) algorithms for graph traversal, including their applications and edge classifications.

Graph

Topological Sorting

DAG and Topological Order

Mathematics

Catalan Number

Interesting equations and findings about Catalan Number

Mathematics

Congruence Equation

Congruence equation problems solutions

Mathematics

Linear Sieve Algorithms

Linear sieve algorithms that optimized number sieving problems

Mathematics

Number Theory

Basic algorithms associated with number theory problems

Dynamic Programming

Interval DP

DP for merging intervals with a cost function.

Dynamic Programming

Shortest Path DP

String

Aho–Corasick Algorithm

dictionary-matching algorithm that locates elements of a finite set of strings

Miscellaneous

Basic C++ Syntax

An overview of basic syntax in C++ programming

Mathematics

Basis of a Vector Space

Data Structures

Balanced Binary Search Tree

AVL trees and red-black trees; Splay trees and treaps

Templates

Arbitrary-Precision Arithmetic (Bignum)

Calculations are not limited to digits of the maximum of languages and computers

Miscellaneous

Binary / Ternary Search on Answer

Monotonicity Problem and Extreme Value Problem

Data Structures

Binary Tree

binary tree, binary search tree, and heap.

Graph

Bipartite Graph

a graph whose vertices can be divided into two disjoint and independent sets

Data Structures

Binary Indexed Tree (BIT)

efficiently compute prefix sums of the values and update the values.

Miscellaneous

Cantor Expansion

Data Structures

Cartesian Tree

It is uniquely defined as a min-heap whose symmetric (in-order) traversal returns the original sequence.

Miscellaneous

Centroid Decomposition

点分治

Mathematics

Combinatorics

Polynomial

Complex Numbers

Data Structures

Heavy-light Decomposition

effectively solve many problems that come down to queries on a tree

Templates

Discretization

transform continuous numbers to discrete numbers

Templates

Encapsulation

Several encapsulation struct methods implemented

Templates

Fast Input and Output (Fast I/O)

use string buffer read to accelerate read and write

Mathematics

Gaussian Elimination

String

Hashing

Hash string into numbers for quick query.

Data Structures

K-D Tree (k-dimensional tree)

a space-partitioning data structure for organizing points in a k-dimensional space.

String

Knuth–Morris–Pratt (KMP) Algorithm

string-searching algorithm that searches for occurrences of a 'word' within a main 'text string'

Miscellaneous

Binary Lifting and Lowest Common Ancestor (LCA)

query in O(log(n))

Miscellaneous

Longest Palindromic Substring

finding a maximum-length contiguous substring of a given string that is a palindrome

Mathematics

Matrix Multiplication

C++ code of matrix multiplication implementation.

Miscellaneous

Maximum Sum Subarray

a contiguous subarray with the largest sum

Mathematics

Möbius

Introduces Mobius function and mobius inversion formula

Miscellaneous

Hill Climbing and Simulated Annealing Algorithms

爬山算法和模拟退火

Data Structures

Segment Tree

storing information about intervals or segments.

Data Structures

Square Root Decomposition and Mo's Algorithm

devides a sequence into sqrt(n) blocks and solve by blocks

Templates

C++ Code Start Template

Templates

Stress Testing Harness

automates the execution of tests, confirm if the results are correct, test extreme data limits

Graph

Tarjan's Algorithm

strongly connected components

String

Trie Tree

prefix tree used to store and retrieve strings from a dictionary or set.

Miscellaneous

Virtual/Auxiliary Trees

虚树

Search

Loading search…