Last active
June 10, 2017 18:26
-
-
Save vaidehijoshi/7f46d1996f43e6704d917928f526a8f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var array = [5, 1, 7, 3, 2, 8, 6, 4]; | |
mergeSort(array); | |
> array is: (2) [5, 1] | |
> left array is: [5] | |
> ** end of merge function ** array is: (2) [1, 5] | |
> array is: (2) [7, 3] | |
> left array is: [7] | |
> ** end of merge function ** array is: (2) [3, 7] | |
> array is: (4) [5, 1, 7, 3] | |
> array is: (4) [1, 1, 7, 3] | |
> array is: (4) [1, 3, 7, 3] | |
> right array is: [7] | |
> ** end of merge function ** array is: (4) [1, 3, 5, 7] | |
> array is: (2) [2, 8] | |
> right array is: [8] | |
> ** end of merge function ** array is: (2) [2, 8] | |
> array is: (2) [6, 4] | |
> left array is: [6] | |
> ** end of merge function ** array is: (2) [4, 6] | |
> array is: (4) [2, 8, 6, 4] | |
> array is: (4) [2, 8, 6, 4] | |
> array is: (4) [2, 4, 6, 4] | |
> left array is: [8] | |
> ** end of merge function ** array is: (4) [2, 4, 6, 8] | |
> array is: (8) [5, 1, 7, 3, 2, 8, 6, 4] | |
> array is: (8) [1, 1, 7, 3, 2, 8, 6, 4] | |
> array is: (8) [1, 2, 7, 3, 2, 8, 6, 4] | |
> array is: (8) [1, 2, 3, 3, 2, 8, 6, 4] | |
> array is: (8) [1, 2, 3, 4, 2, 8, 6, 4] | |
> array is: (8) [1, 2, 3, 4, 5, 8, 6, 4] | |
> array is: (8) [1, 2, 3, 4, 5, 6, 6, 4] | |
> right array is: [8] | |
> ** end of merge function ** array is: (8) [1, 2, 3, 4, 5, 6, 7, 8] | |
>> (8) [1, 2, 3, 4, 5, 6, 7, 8]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment