Merge Sort
Array
   Step-by-Step Animation   Animation Speed 
Elaboration:
?
Merge Sort: Merge sort uses the divide and conquer method where it splits the array into two halves by recursively calling these two subarrays, and then merging these two sorted arrays together. The time complexity of the entire sort operation is O(n·log(n)) where n is the size of the array.
Recursion Details:
1. If the array size is 1, return.
2. If the array size is 2, when the first element is greater than the second element, make a swap and then return.
3. If the array size is >= 3, we split the array into two halves by making two recursive calls. When they return, we merge them.
Animation Input: Enter a series of numbers that are separated by space.
归并排序:栈归并排序,是创建在归并操作上的一种有效的排序算法,效率为O(nlogn) 。该算法是采用分治法的一个非常典型的应用,且各层分治递归可以同时进行。
Recursion Details:
1. If the array size is 1, return.
2. If the array size is 2, when the first element is greater than the second element, make a swap and then return.
3. If the array size is >= 3, we split the array into two halves by making two recursive calls. When they return, we merge them.
按键说明:Run:在文本框中输入要进行排序的数字,数字间用空格来隔开。之后点击”run”,在下方就会显示出输入的数字(初始排序以用户输入为准),并开始进行归并排序演示,最终以从小到大的顺序从左至右依次排开。(建议开始排序之前点击” Step-by-Step Animation”按钮,然后通过”Go Back”和”Go Forward”按钮来一步一步观看)。