QuickSort and MergeSort in JAVA


QuickSort is a very famous sort algorithm, Arrays.sort is realized by QuickSort.


The basic method is following:
1. Choosing a pivot, always the lowest value.
2. Dividing the array into two parts, the lower part will be put left of the pivot, and the larger part is right.
3. With each round, the pivot will move to the final position in the array.
4. Repeat the process, until the sort is completed.

Continue reading “QuickSort and MergeSort in JAVA”

Leetcode 210. Course Schedule II

210. Course Schedule II


There are a total of n courses you have to take, labeled from 0 to n - 1.

Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1]

Continue reading “Leetcode 210. Course Schedule II”