diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md index d193a22be5..dc89454b9c 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-disjoint-sublist.md @@ -26,8 +26,8 @@ Where the correct result would be: tests: - text: sortDisjoint should be a function. testString: assert(typeof sortDisjoint == 'function', 'sortDisjoint should be a function.'); - - text: sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return a array. - testString: assert(Array.isArray(sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7])), 'sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return a array.'); + - text: sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return an array. + testString: assert(Array.isArray(sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7])), 'sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return an array.'); - text: sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return [7, 0, 5, 4, 3, 2, 1, 6]. testString: assert.deepEqual(sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]), [7, 0, 5, 4, 3, 2, 1, 6], 'sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [6, 1, 7]) should return [7, 0, 5, 4, 3, 2, 1, 6].'); - text: sortDisjoint([7, 6, 5, 4, 3, 2, 1, 0], [1, 2, 5, 6]) should return [7, 1, 2, 4, 3, 5, 6, 0]. diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-using-a-custom-comparator.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-using-a-custom-comparator.md index 07e086a561..54251139db 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-using-a-custom-comparator.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sort-using-a-custom-comparator.md @@ -13,6 +13,7 @@ Write a function to sort an array (or list) of strings in order of descending le
+ ## Tests
@@ -20,8 +21,8 @@ Write a function to sort an array (or list) of strings in order of descending le tests: - text: lengthSorter should be a function. testString: assert(typeof lengthSorter == 'function', 'lengthSorter should be a function.'); - - text: lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return a array. - testString: assert(Array.isArray(lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"])), 'lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return a array.'); + - text: lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return an array. + testString: assert(Array.isArray(lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"])), 'lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return an array.'); - text: lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return ["strings", "sample", "sorted", "Here", "some", "are", "be", "to"]. testString: assert.deepEqual(lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]), ["strings", "sample", "sorted", "Here", "some", "are", "be", "to"], 'lengthSorter(["Here", "are", "some", "sample", "strings", "to", "be", "sorted"]) should return ["strings", "sample", "sorted", "Here", "some", "are", "be", "to"].'); - text: lengthSorter(["I", "hope", "your", "day", "is", "going", "good", "?"]) should return ["going", "good", "hope", "your", "day", "is", "?","I"]. @@ -41,7 +42,7 @@ tests:
```js -function lengthSorter (arr) { +function lengthSorter(arr) { // Good luck! } ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bead-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bead-sort.md index 45aa965d86..18f019e4f8 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bead-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bead-sort.md @@ -6,9 +6,9 @@ challengeType: 5 ## Description
-Sort an array of positive integers using the Bead Sort Algorithm. +Sort an array of positive integers using the Bead Sort Algorithm. A bead sort is also known as a gravity sort. -Algorithm has O(S), where S is the sum of the integers in the input set: Each bead is moved individually. +The algorithm has O(S), where S is the sum of the integers in the input set: Each bead is moved individually. This is the case when bead sort is implemented without a mechanism to assist in finding empty spaces below the beads, such as in software implementations.
@@ -24,8 +24,8 @@ This is the case when bead sort is implemented without a mechanism to assist in tests: - text: beadSort should be a function. testString: assert(typeof beadSort == 'function', 'beadSort should be a function.'); - - text: beadSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(beadSort([25, 32, 12, 7, 20])), 'beadSort([25, 32, 12, 7, 20]) should return a array.'); + - text: beadSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(beadSort([25, 32, 12, 7, 20])), 'beadSort([25, 32, 12, 7, 20]) should return an array.'); - text: beadSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(beadSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'beadSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: beadSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -45,7 +45,7 @@ tests:
```js -function beadSort (arr) { +function beadSort(arr) { // Good luck! } ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bogosort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bogosort.md index 95d0843d28..61b3e87396 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bogosort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bogosort.md @@ -6,15 +6,17 @@ challengeType: 5 ## Description
-Bogosort a list of numbers. +Bogosort a list of numbers. Bogosort simply shuffles a collection randomly until it is sorted. "Bogosort" is a perversely inefficient algorithm only used as an in-joke. Its average run-time is O(n!) because the chance that any given shuffle of a set will end up in sorted order is about one in n factorial, and the worst case is infinite since there's no guarantee that a random shuffling will ever produce a sorted sequence. Its best case is O(n) since a single pass through the elements may suffice to order them. Pseudocode: +
 while not InOrder(list) do
-Shuffle(list)
+  Shuffle(list)
 done
+
## Instructions @@ -29,8 +31,8 @@ Shuffle(list) tests: - text: bogosort should be a function. testString: assert(typeof bogosort == 'function', 'bogosort should be a function.'); - - text: bogosort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(bogosort([25, 32, 12, 7, 20])), 'bogosort([25, 32, 12, 7, 20]) should return a array.'); + - text: bogosort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(bogosort([25, 32, 12, 7, 20])), 'bogosort([25, 32, 12, 7, 20]) should return an array.'); - text: bogosort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(bogosort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'bogosort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: bogosort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -50,7 +52,7 @@ tests:
```js -function bogosort (v) { +function bogosort(v) { // Good luck! } ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md index 6bc0f24de8..e3f95d7a29 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-cocktail-sort.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
-The cocktail shaker sort is an improvement on the Bubble Sort. The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from wikipedia):

+The cocktail shaker sort is an improvement on the Bubble Sort. The improvement is basically that values "bubble" both directions through the array, because on each iteration the cocktail shaker sort bubble sorts once forwards and once backwards. Pseudocode for the algorithm (from wikipedia):

 function cocktailSort( A : list of sortable items )
   do
@@ -29,12 +29,11 @@ The cocktail shaker sort is an improvement on the Bubble Sort.
-Like the Shell sort, the Comb Sort increases the gap used in comparisons and exchanges.
+The Comb Sort is a variant of the Bubble Sort.
+Like the Shell sort, the Comb Sort increases the gap used in comparisons and exchanges.
 Dividing the gap by $(1-e^{-\varphi})^{-1} \approx 1.247330950103979$ works best, but 1.3 may be more practical.
 Some implementations use the insertion sort once the gap is less than a certain amount.
 Also see
 
 Variants:
 
    @@ -45,12 +45,11 @@ Pseudocode: end loop end function
-Write a function that sorts a given array using Comb sort.
## Instructions
- +Write a function that sorts a given array using Comb sort.
## Tests @@ -60,8 +59,8 @@ Write a function that sorts a given array using Comb sort. tests: - text: combSort should be a function. testString: assert(typeof combSort == 'function', 'combSort should be a function.'); - - text: combSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(combSort([25, 32, 12, 7, 20])), 'combSort([25, 32, 12, 7, 20]) should return a array.'); + - text: combSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(combSort([25, 32, 12, 7, 20])), 'combSort([25, 32, 12, 7, 20]) should return an array.'); - text: combSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(combSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'combSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: combSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -81,7 +80,7 @@ tests:
```js -function combSort (arr) { +function combSort(arr) { // Good luck! } ``` @@ -93,7 +92,7 @@ function combSort (arr) {
```js -function combSort (arr) { +function combSort(arr) { function is_array_sorted(arr) { var sorted = true; for (var i = 0; i < arr.length - 1; i++) { diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md index 42c0534f1b..b92481ac8d 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-gnome-sort.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
-Gnome sort is a sorting algorithm which is similar to Insertion sort, except that moving an element to its proper place is accomplished by a series of swaps, as in Bubble Sort. +Gnome sort is a sorting algorithm which is similar to Insertion sort, except that moving an element to its proper place is accomplished by a series of swaps, as in Bubble Sort. The pseudocode for the algorithm is:
 function gnomeSort(a[0..size-1])
@@ -27,12 +27,11 @@ The pseudocode for the algorithm is:
     endif
   done
 
-Write a function to implement the above pseudo code. The function should return the sorted array.
## Instructions
- +Write a function to implement the above pseudo code. The function should return the sorted array.
## Tests @@ -42,8 +41,8 @@ Write a function to implement the above pseudo code. The function should return tests: - text: gnomeSort should be a function. testString: assert(typeof gnomeSort == 'function', 'gnomeSort should be a function.'); - - text: gnomeSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(gnomeSort([25, 32, 12, 7, 20])), 'gnomeSort([25, 32, 12, 7, 20]) should return a array.'); + - text: gnomeSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(gnomeSort([25, 32, 12, 7, 20])), 'gnomeSort([25, 32, 12, 7, 20]) should return an array.'); - text: gnomeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(gnomeSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'gnomeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: gnomeSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md index 0dcdbd5ffd..5b277ec0cc 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-pancake-sort.md @@ -6,11 +6,11 @@ challengeType: 5 ## Description
-Write a function to sort an array of integers (of any convenient size) into ascending order using Pancake sorting. The function should return the sorted array. +Write a function to sort an array of integers (of any convenient size) into ascending order using Pancake sorting. The function should return the sorted array. In short, instead of individual elements being sorted, the only operation allowed is to "flip" one end of the list, like so:
 Before:
-6 7 8 9 2 5 3 4 1
+6 7 8 9 2 5 3 4 1
After: 9 8 7 6 2 5 3 4 1
@@ -29,8 +29,8 @@ Only one end of the list can be flipped; this should be the low end, but the hig tests: - text: pancakeSort should be a function. testString: assert(typeof pancakeSort == 'function', 'pancakeSort should be a function.'); - - text: pancakeSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(pancakeSort([25, 32, 12, 7, 20])), 'pancakeSort([25, 32, 12, 7, 20]) should return a array.'); + - text: pancakeSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(pancakeSort([25, 32, 12, 7, 20])), 'pancakeSort([25, 32, 12, 7, 20]) should return an array.'); - text: pancakeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(pancakeSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'pancakeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: pancakeSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -50,7 +50,7 @@ tests:
```js -function pancakeSort (arr) { +function pancakeSort(arr) { // Good luck! } ``` diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-permutation-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-permutation-sort.md index 2ec2dc5678..8e79dfc0f6 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-permutation-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-permutation-sort.md @@ -27,8 +27,8 @@ Pseudocode: tests: - text: permutationSort should be a function. testString: assert(typeof permutationSort == 'function', 'permutationSort should be a function.'); - - text: permutationSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(permutationSort([25, 32, 12, 7, 20])), 'permutationSort([25, 32, 12, 7, 20]) should return a array.'); + - text: permutationSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(permutationSort([25, 32, 12, 7, 20])), 'permutationSort([25, 32, 12, 7, 20]) should return an array.'); - text: permutationSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(permutationSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'permutationSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: permutationSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -48,7 +48,7 @@ tests:
```js -function permutationSort (arr) { +function permutationSort(arr) { // Good luck! } ``` @@ -60,7 +60,7 @@ function permutationSort (arr) {
```js -function permutationSort (arr) { +function permutationSort(arr) { function pSort(a) { var list = []; permute(a, a.length, list); diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md index ff99c2e060..3de9e05bdd 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-shell-sort.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
-Write a function to sort an array of elements using the Shell sort algorithm, a diminishing increment sort. The function should return the sorted array. +Write a function to sort an array of elements using the Shell sort algorithm, a diminishing increment sort. The function should return the sorted array. The Shell sort (also known as Shellsort or Shell's method) is named after its inventor, Donald Shell, who published the algorithm in 1959. Shell sort is a sequence of interleaved insertion sorts based on an increment sequence. The increment size is reduced after each pass until the increment size is 1. With an increment size of 1, the sort is a basic insertion sort, but by this time the data is guaranteed to be almost sorted, which is insertion sort's "best case". @@ -26,8 +26,8 @@ Empirical studies have shown a geometric increment sequence with a ratio of abou tests: - text: shellSort should be a function. testString: assert(typeof shellSort == 'function', 'shellSort should be a function.'); - - text: shellSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(shellSort([25, 32, 12, 7, 20])), 'shellSort([25, 32, 12, 7, 20]) should return a array.'); + - text: shellSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(shellSort([25, 32, 12, 7, 20])), 'shellSort([25, 32, 12, 7, 20]) should return an array.'); - text: shellSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(shellSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'shellSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: shellSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -47,7 +47,7 @@ tests:
```js -function shellSort (a) { +function shellSort(a) { // Good luck! } ``` @@ -59,7 +59,7 @@ function shellSort (a) {
```js -function shellSort (a) { +function shellSort(a) { for (var h = a.length; h > 0; h = parseInt(h / 2)) { for (var i = h; i < a.length; i++) { var k = a[i]; diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md index 63a394353f..700fcedd21 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-stooge-sort.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
-Write a function to permform Stooge Sort on an array of integers. The function should return a sorted array. +Write a function to permform Stooge Sort on an array of integers. The function should return a sorted array. The Stooge Sort algorithm is as follows:
 algorithm stoogesort(array L, i = 0, j = length(L)-1)
@@ -33,8 +33,8 @@ The Stooge Sort algorithm is as follows:
 tests:
   - text: stoogeSort should be a function.
     testString: assert(typeof stoogeSort == 'function', 'stoogeSort should be a function.');
-  - text: stoogeSort([25, 32, 12, 7, 20]) should return a array.
-    testString: assert(Array.isArray(stoogeSort([25, 32, 12, 7, 20])), 'stoogeSort([25, 32, 12, 7, 20]) should return a array.');
+  - text: stoogeSort([25, 32, 12, 7, 20]) should return an array.
+    testString: assert(Array.isArray(stoogeSort([25, 32, 12, 7, 20])), 'stoogeSort([25, 32, 12, 7, 20]) should return an array.');
   - text: stoogeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].
     testString: assert.deepEqual(stoogeSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'stoogeSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].');
   - text: stoogeSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45].
@@ -54,7 +54,7 @@ tests:
 
```js -function stoogeSort (arr) { +function stoogeSort(arr) { // Good luck! } ``` @@ -66,7 +66,7 @@ function stoogeSort (arr) {
```js -function stoogeSort (arr) { +function stoogeSort(arr) { function stoogeSortRecurse(array, i, j) { if (j === undefined) { j = array.length - 1; diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md index d729e7bbf5..69dab8e72f 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md +++ b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-strand-sort.md @@ -6,7 +6,7 @@ challengeType: 5 ## Description
-Write a function to sort an array using the Strand sort. The function should return the sorted array. +Write a function to sort an array using the Strand sort. The function should return the sorted array. This is a way of sorting numbers by extracting shorter sequences of already sorted numbers from an unsorted list.
@@ -22,8 +22,8 @@ This is a way of sorting numbers by extracting shorter sequences of already sort tests: - text: strandSort should be a function. testString: assert(typeof strandSort == 'function', 'strandSort should be a function.'); - - text: strandSort([25, 32, 12, 7, 20]) should return a array. - testString: assert(Array.isArray(strandSort([25, 32, 12, 7, 20])), 'strandSort([25, 32, 12, 7, 20]) should return a array.'); + - text: strandSort([25, 32, 12, 7, 20]) should return an array. + testString: assert(Array.isArray(strandSort([25, 32, 12, 7, 20])), 'strandSort([25, 32, 12, 7, 20]) should return an array.'); - text: strandSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32]. testString: assert.deepEqual(strandSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'strandSort([25, 32, 12, 7, 20]) should return [7, 12, 20, 25, 32].'); - text: strandSort([38, 45, 35, 8, 13]) should return [8, 13, 35, 38, 45]. @@ -43,7 +43,7 @@ tests:
```js -function strandSort (list) { +function strandSort(list) { // Good luck! } ``` @@ -55,7 +55,7 @@ function strandSort (list) {
```js -function strandSort (list) { +function strandSort(list) { function merge(left, right) { var result = [];