Programming Contest Crib Sheet
November 2010: Here is our official C++ cribsheet.
We can continue to add and revise this, and we might
consider doing a translation to a Java version as well.
Here is an older outline of a potential crib sheet, with some
additional details linked below.
-
Parsing Input
-
Standard format of first line which identifies
number of following trials.
-
Standard format of read trials until reaching a
sentinal value.
-
Formatted Output
-
Controlling precision for floating-point numbers
-
How to convert an int to a string in C++ (using strstream)
-
Bit Manipulations
-
Querying the k-th bit
-
Setting the k-th bit to 0
-
Setting the k-th bit to 1
-
Bit shifting to multiply/divide by powers of two
-
Using the C++ STL bitset class
-
Brute-force Enumerations
-
Mathematics Fundamentals
-
Number Theory (base conversions, prime
factorizations, fractions, gcd, lcm)
-
Distance between two points
-
Vector between two points (and normalization)
-
Distance from a point to a line
-
Computing line or line segment intersections
-
Area of a triangle
-
Graph Algorithms (our code base)
-
Basic graph library
- undirected/directed
- weighted/unweighted
- associated node data, edge data
-
DFS, BFS
-
Graph connectivity and reachability
-
(Bi)Connected Components
-
Topological Orderings for DAGs
-
Minimum Spanning Trees
-
Shortest Paths Algorithm (Bellman-Ford)
-
Matching Algorithms
-
Network Flow
-
Dynamic Programming
-
Selecting a subset of items with some score
-
Breaking a sequence into k independent pieces
-
Aligning two sequences to each other
Michael Goldwasser
Last modified: Monday, 12 September 2011