Open mahiki opened 9 years ago
====================================================================
1. FUNDAMENTALS
====================================================================
Improve BinarySearch API. All metods should work on sorted arrays (duplicates allowed).
- indexOf(key): index of (any) occurrence of a given key
- firstIndexOf(key), lastIndexOf(key): index of first/last occurrence of a given key
- floor(key), ceil(key): index of largest/smallest key less/greater than or equal to a given key
- pred(key), succ(key): index of largest/smallest key strictly less/greater than a given key)
- count(key): number of entries equal to a given key
- rank(key): number of keys strictly less than a given key
- contains(key): is the given key in the array?
- rangeCount(key1, key2): number of keys between key1 (inclusive) and key2 (exclusive)
[ should be relatively easy, but need care to get it right and do it elegantly ]
====================================================================
2. SORTING
====================================================================
Binary insertion sort
[ should be easy, just be careful to preserve stability ]
Three-pivot quicksort
Timsort
Smoothsort (heapsort variant invented by Dijkstra)
For a good description, see http://www.keithschwarz.com/smoothsort/
Binary heap (optimized)
- replace full exchanges with half exchanges
- use shifting instead of integer division?
- consider trick of sinking all the way to a leaf (only 1 compare per level down),
then swimming up (1 compare per level up). If the key sinks down most of the way
(as is likely), this will be an improvement
Pairing heap
- among fastest in practice
B-heap
- to exploit caching with large priority queues
====================================================================
3. SEARCHING
====================================================================
Splay tree
- see http://algs4.cs.princeton.edu/33balanced/SplayBST.java.html
- not yet throughly tested
AVL tree
Cuckoo hashing (but how to get two hash functions in Java?)
Tabulation hashing (but how to get two hash functions in Java?)
Universal hashing (but how to get a parameterized hash function in Java?)
====================================================================
4. GRAPHS
====================================================================
Euler path / cycle
- use depth-first search
- see Algorithms, 3rd edition
Directed Euler path /cycle
- use depth-first search
Nonrecursive depth-first search algorithms (to avoid excesive stack sizes)
- undirected depth-first search (already available)
http://algs4.cs.princeton.edu/41undirected/NonrecursiveDFS.java.html
- cycle, directed cycle, bipartiteness, topological
(should be straightforward - some algorithms can be done with BFS or
DFS-like algorithm)
- nonrecursive strong components (some could be tricky, but Kosaraju-Sharir
should be easy since second DFS can be replaced by BFS)
All cycles in a graph or all directed cycles in a digraph
- Paton's algoriths for graphs
- Tiernan, Johnson, Tarjan, Szwarcfiter-Lauer
- see http://code.google.com/p/niographs/
Planarity testing (and embedding)
- very tricky algorithm and code
Bipartite matching
- achieve O(E sqrt(V)) running time
- use Even-Tarjan (http://www.cs.princeton.edu/courses/archive/spring13/cos423/lectures/07NetworkFlowI-2x2.pdf)
Biconnected components and bridges
- design API
- see http://algs4.cs.princeton.edu/41undirected/Biconnected.java.html
- see http://algs4.cs.princeton.edu/41undirected/Bridge.java.html
GraphGenerator
- for some families, see http://en.wikipedia.org/wiki/Gallery_of_named_graphs
- see also http://algs4.cs.princeton.edu/42directed/DigraphGenerator.java.html
Dijkstra's algorithm in undirected graphs
[ should be extremely easy, but need separate class because pathTo() returns
an iterable of DirectedEdge objects ]
====================================================================
5. STRINGS
====================================================================
Optimized two-array radix sort
- use explicit stack instead of recursion (so that you don't
need to save the count[] array in each recursive call and you don't
need to reallocate the count[] array but can reset to 0)
- See Mcilroy-Bostic-McIlroy paper
In-place MSD radix sort
- http://erik.gorset.no/2011/04/radix-sort-is-faster-than-quicksort.html
- See Mcilroy-Bostic-McIlroy paper
Radix trie
DAWG
- directed acyclic word graph
====================================================================
6. CONTEXT
====================================================================
Network simplex
- for min cost flow or transportation problem
- see Algorithms, 3rd edition in Java
(Weighted) nonbipartite matching
- tricky to implement
Delaunay triangulation / Voronoi
- tricky to implement in N log N time
Range minimum query (RMQ) / lowest common ancestor (LCA) / Cartesian tree
http://courses.csail.mit.edu/6.851/spring12/scribe/L15.pdf
PADS
public domain algorithms (in Python) by David Eppstein
http://www.ics.uci.edu/~eppstein/PADS/
[includes implementation of Edmonds nonbipartite matching algorithm
and Hopcroft-Karp for bipartite matching]
http://algs4.cs.princeton.edu/code/wishlist.txt
Another way to prove yourself