Posts

We continue to use email for information exchange.  And we will use github to post  session notes: https://github.com/vzhang2008/competitive

Summary of Class 15 DAG -- Topological Sorting (USACO 4.4)

“To improve is to change; to be perfect is to change often.”  ―  Winston S. Churchill Version Control (or Revision control or source control): Version Control System (VCS) Concurrent Version System (CVS) Subversion (SVN) git command:     git add . (or file)     git commit -m "msg"     git push origin <branch-name> https://services.github.com/on-demand/downloads/github-git-cheat-sheet/ Review of SCC, DFS, BFS SCC: A digraph is strongly connected if every two vertices are  mutually reachable . A strong component of a digraph G is a maximal strongly connected subdigraph of G. Equivalently, a strong component is a subdigraph induced on a maximal set of mutually reachable vertices. Graph DFS: stack-based :  (for loop with visited vertices)     tree edge,     forward edge    ...

Summary of Class 14 Strongly Connected Components (SCC)

Try not to become a man of success, but rather try to become a man of value.   - Albert Einstein 不自见故明;不自是故彰;不自伐故有功;不自矜 故长。 夫唯不争,故天下莫能与之争。 Data Structure Review (C++ STL) : array(array), dynamic array (vector) doubly linked list (list), singly linked list (forward_list) stack, queue, priority_queue (heap structure) binary tree, binary search tree (BST) graph (adjacent list, adjacent matrix, edge list) union-find data structure  A directed graph is strongly connected if there is a path between all pairs of vertices. https://en.wikipedia.org/wiki/Strongly_connected_component Kosaraju’s algorithm 1) Do DFS and push the vertex to stack S.      For each vertex u of the graph, mark u as unvisited in visited[] array. Let Stack S be empty.      For each vertex u of the graph do dfs(u, visited, S), where dfs() is the recursive subroutine:          mark u as visited:   ...

Summary of Class 13. Hamiltonian path

Success is not final, failure is not fatal: it is the courage to continue that counts. ―  Winston S. Churchill A  Hamiltonian path  or  traceable path  is a  path  that visits each vertex of the graph exactly once. A  Hamiltonian cycle  (or  Hamiltonian circuit ) is a Hamiltonian Path such that there is an edge (in graph) from the last vertex to the first vertex of the Hamiltonian Path.  0. Permutation and combination set and subset: sequence and subsequence: https://www.mathsisfun.com/sets/sets-introduction.html http://www.mathsisfun.com/algebra/sequences-series.html permutation: the act of arranging all the members of a set into some sequence or order combination: a selection of items from a collection without order https://www.mathsisfun.com/combinatorics/combinations-permutations.html Problem : print all the combination of "abcd".  backtracking-like method and bitmask method. Solution: re...