All of the above code is the basic algorithm in Algorithm-4th-Edtion, These are very basic things.
At the moment, i just added the original book without giving the sorting visualization window code. To facilitate myself and those who need it to view and study. (2017/03/17)
Hope you will like it ! ^ _ ^
Dependencies: algs4.jar
Data files: http://algs4.cs.princeton.edu/code/algs4.jar
Tips: There is a problem worthy of our attention. The stack used in book(or algs4.jar) is not the same as the JDK. In fact, there is a bug in JDK of Stack since JDK 1.3, while you use foreach loop to iterate an array, you will find that the order isn't from bottom to top as you like. It will iterate it from top to bottom. More information you can see this article (CSDN_Blog) or official website(Oracle).
Modified for a test.
- Binary Heap Sort(sink)
- Quick3way (array contains many duplicate numbers)
- Quick Sort
- Select Sort
- Insert Sort
- Merge Sort (Top-Down)
- Merge Sort(Bottom-Up)
- RedBlackTree (2-3 tree)
- Interpolation Search (like binary search)
- Binary Search Tree (Key-Value)
- Binary Search(Recursive and Iterative)
- Prim MST
- Index minimum priority queue
- Lazy prim MST
- EdgeWeightedGraph
- Transitive Closure
- KosarajuSCC
- Topological sort
- Directed cycle
- Symbol digraph
- Breadth first paths
- CComponent
- Directed DFS
- Depth first paths
- Depth first order
- Symbol Graph
- Depth First Search (contains paths)
- Breadth First Search (contains paths)
- Connected Component
contains "Sort Compare" and others pre-algorithm like "less", "exch"... etc.
visualization window now only can paint RED(has been moved) and GRAY(not been moved)