diff --git a/curriculum/challenges/_meta/rosetta-code/meta.json b/curriculum/challenges/_meta/rosetta-code/meta.json
index 13f0bb2305..2e46556e0b 100644
--- a/curriculum/challenges/_meta/rosetta-code/meta.json
+++ b/curriculum/challenges/_meta/rosetta-code/meta.json
@@ -380,10 +380,6 @@
"5a23c84252665b21eecc8002",
"Sorting algorithms/Bogosort"
],
- [
- "5a23c84252665b21eecc8003",
- "Sorting algorithms/Bubble sort"
- ],
[
"5a23c84252665b21eecc8004",
"Sorting algorithms/Cocktail sort"
@@ -392,26 +388,10 @@
"5a23c84252665b21eecc8005",
"Sorting algorithms/Comb sort"
],
- [
- "5a23c84252665b21eecc8006",
- "Sorting algorithms/Counting sort"
- ],
[
"5a23c84252665b21eecc8007",
"Sorting algorithms/Gnome sort"
],
- [
- "5a23c84252665b21eecc8008",
- "Sorting algorithms/Heapsort"
- ],
- [
- "5a23c84252665b21eecc8009",
- "Sorting algorithms/Insertion sort"
- ],
- [
- "5a23c84252665b21eecc800a",
- "Sorting algorithms/Merge sort"
- ],
[
"5a23c84252665b21eecc800b",
"Sorting algorithms/Pancake sort"
@@ -420,18 +400,6 @@
"5a23c84252665b21eecc800c",
"Sorting algorithms/Permutation sort"
],
- [
- "5a23c84252665b21eecc800d",
- "Sorting algorithms/Quicksort"
- ],
- [
- "5a23c84252665b21eecc800e",
- "Sorting algorithms/Radix sort"
- ],
- [
- "5a23c84252665b21eecc800f",
- "Sorting algorithms/Selection sort"
- ],
[
"5a23c84252665b21eecc8010",
"Sorting algorithms/Shell sort"
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bubble-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bubble-sort.md
deleted file mode 100644
index 76d06b50d4..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-bubble-sort.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-id: 5a23c84252665b21eecc8003
-title: Sorting algorithms/Bubble sort
-challengeType: 5
----
-
-## Description
-
-Sort an array of elements using the bubble sort algorithm. The elements must have a total order and the index of the array can be of any discrete type.
-The bubble sort is generally considered to be the simplest sorting algorithm.
-Because of its simplicity and ease of visualization, it is often taught in introductory computer science courses.
-Because of its abysmal O(n2) performance, it is not used often for large (or even medium-sized) datasets.
-The bubble sort works by passing sequentially over a list, comparing each value to the one immediately after it. If the first value is greater than the second, their positions are switched. Over a number of passes, at most equal to the number of elements in the list, all of the values drift into their correct positions (large values "bubble" rapidly toward the end, pushing others down around them). Because each pass finds the maximum item and puts it at the end, the portion of the list to be sorted can be reduced at each pass. A boolean variable is used to track whether any changes have been made in the current pass; when a pass completes without changing anything, the algorithm exits.
-This can be expressed in pseudo-code as follows (assuming 1-based indexing):
-
-repeat
- hasChanged := false
- decrement itemCount
- repeat with index from 1 to itemCount
- if (item at index) > (item at (index + 1))
- swap (item at index) with (item at (index + 1))
- hasChanged := true
-until hasChanged = false
-
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: bubblesort
should be a function.
- testString: assert(typeof bubblesort == 'function', 'bubblesort
should be a function.');
- - text: bubblesort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(bubblesort([25, 32, 12, 7, 20])), 'bubblesort([25, 32, 12, 7, 20])
should return a array.');
- - text: bubblesort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(bubblesort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'bubblesort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: bubblesort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(bubblesort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'bubblesort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: bubblesort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(bubblesort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'bubblesort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: bubblesort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(bubblesort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'bubblesort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: bubblesort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(bubblesort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'bubblesort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function bubblesort(arr) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function bubblesort (arr) {
- var done = false;
- while (!done) {
- done = true;
- for (var i = 1; i arr[i]) {
- done = false;
- [arr[i-1], arr[i]] = [arr[i], arr[i-1]]
- }
- }
- }
- return arr;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-counting-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-counting-sort.md
deleted file mode 100644
index ef88093722..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-counting-sort.md
+++ /dev/null
@@ -1,96 +0,0 @@
----
-id: 5a23c84252665b21eecc8006
-title: Sorting algorithms/Counting sort
-challengeType: 5
----
-
-## Description
-
-Implement the Counting sort. This is a way of sorting integers when the minimum and maximum value are known.
-Pseudocode:
-
-function countingSort(array, min, max):
- count: array of (max - min + 1) elements
- initialize count with 0
- for each number in array do
- count[number - min] := count[number - min] + 1
- done
- z := 0
- for i from min to max do
- while ( count[i - min] > 0 ) do
- array[z] := i
- z := z+1
- count[i - min] := count[i - min] - 1
- done
- done
-
-Write a function to implement the above pseudo code. The function should return the sorted array.
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: countSort
should be a function.
- testString: assert(typeof countSort == 'function', 'countSort
should be a function.');
- - text: countSort([25, 32, 12, 7, 20],7, 32)
should return a array.
- testString: assert(Array.isArray(countSort([25, 32, 12, 7, 20], 7, 32)), 'countSort([25, 32, 12, 7, 20],7, 32)
should return a array.');
- - text: countSort([25, 32, 12, 7, 20],7, 32)
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(countSort([25, 32, 12, 7, 20], 7, 32), [7, 12, 20, 25, 32], 'countSort([25, 32, 12, 7, 20],7, 32)
should return [7, 12, 20, 25, 32]
.');
- - text: countSort([38, 45, 35, 8, 13],8, 45)
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(countSort([38, 45, 35, 8, 13], 8, 45), [8, 13, 35, 38, 45], 'countSort([38, 45, 35, 8, 13],8, 45)
should return [8, 13, 35, 38, 45]
.');
- - text: countSort([43, 36, 20, 34, 24],20, 43)
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(countSort([43, 36, 20, 34, 24], 20, 43), [20, 24, 34, 36, 43], 'countSort([43, 36, 20, 34, 24],20, 43)
should return [20, 24, 34, 36, 43]
.');
- - text: countSort([12, 33, 26, 18, 1, 16, 38],1, 38)
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(countSort([12, 33, 26, 18, 1, 16, 38], 1, 38), [1, 12, 16, 18, 26, 33, 38], 'countSort([12, 33, 26, 18, 1, 16, 38],1, 38)
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: countSort([3, 39, 48, 16, 1, 4, 29],1, 48)
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(countSort([3, 39, 48, 16, 1, 4, 29], 1, 48), [1, 3, 4, 16, 29, 39, 48], 'countSort([3, 39, 48, 16, 1, 4, 29],1, 48)
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function countSort (arr, min, max) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function countSort (arr, min, max) {
- var i, z = 0,
- count = [];
-
- for (i = min; i <= max; i++) {
- count[i] = 0;
- }
-
- for (i = 0; i < arr.length; i++) {
- count[arr[i]]++;
- }
-
- for (i = min; i <= max; i++) {
- while (count[i]-- > 0) {
- arr[z++] = i;
- }
- }
- return arr;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-heapsort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-heapsort.md
deleted file mode 100644
index 9bef172049..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-heapsort.md
+++ /dev/null
@@ -1,146 +0,0 @@
----
-id: 5a23c84252665b21eecc8008
-title: Sorting algorithms/Heapsort
-challengeType: 5
----
-
-## Description
-
-Heapsort is an in-place sorting algorithm with worst case and average complexity of O(n logn).
-The basic idea is to turn the array into a binary heap structure, which has the property that it allows efficient retrieval and removal of the maximal element.
-We repeatedly "remove" the maximal element from the heap, thus building the sorted list from back to front.
-Heapsort requires random access, so can only be used on an array-like data structure.
-Pseudocode:
-
-function heapSort(a, count) is
- input: an unordered array a of length count
- (first place a in max-heap order)
- heapify(a, count)
- end := count - 1
- while end > 0 do
- (swap the root(maximum value) of the heap with the
- last element of the heap)
- swap(a[end], a[0])
- (decrement the size of the heap so that the previous
- max value will stay in its proper place)
- end := end - 1
- (put the heap back in max-heap order)
- siftDown(a, 0, end)
-
-
-function heapify(a,count) is
- (start is assigned the index in a of the last parent node)
- start := (count - 2) / 2
- while start ≥ 0 do
- (sift down the node at index start to the proper place
- such that all nodes below the start index are in heap
- order)
- siftDown(a, start, count-1)
- start := start - 1
- (after sifting down the root all nodes/elements are in heap order)
-function siftDown(a, start, end) is
- (end represents the limit of how far down the heap to sift)
- root := start
- while root * 2 + 1 ≤ end do (While the root has at least one child)
- child := root * 2 + 1 (root*2+1 points to the left child)
- (If the child has a sibling and the child's value is less than its sibling's...)
- if child + 1 ≤ end and a[child] < a[child + 1] then
- child := child + 1 (... then point to the right child instead)
- if a[root] < a[child] then (out of max-heap order)
- swap(a[root], a[child])
- root := child (repeat to continue sifting down the child now)
- else
- return
-
-Write a function to sort a collection of integers using heapsort.
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: heapSort
should be a function.
- testString: assert(typeof heapSort == 'function', 'heapSort
should be a function.');
- - text: heapSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(heapSort([25, 32, 12, 7, 20])), 'heapSort([25, 32, 12, 7, 20])
should return a array.');
- - text: heapSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(heapSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'heapSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: heapSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(heapSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'heapSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: heapSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(heapSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'heapSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: heapSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(heapSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'heapSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: heapSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(heapSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'heapSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function heapSort (arr) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function heapSort (arr) {
- function swap(data, i, j) {
- var tmp = data[i];
- data[i] = data[j];
- data[j] = tmp;
- }
-
- function put_array_in_heap_order(arr) {
- var i;
- i = arr.length / 2 - 1;
- i = Math.floor(i);
- while (i >= 0) {
- sift_element_down_heap(arr, i, arr.length);
- i -= 1;
- }
- }
-
- function sift_element_down_heap(heap, i, max) {
- var i_big, c1, c2;
- while (i < max) {
- i_big = i;
- c1 = 2 * i + 1;
- c2 = c1 + 1;
- if (c1 < max && heap[c1] > heap[i_big])
- i_big = c1;
- if (c2 < max && heap[c2] > heap[i_big])
- i_big = c2;
- if (i_big == i) return;
- swap(heap, i, i_big);
- i = i_big;
- }
- }
- put_array_in_heap_order(arr);
- var end = arr.length - 1;
- while (end > 0) {
- swap(arr, 0, end);
- sift_element_down_heap(arr, 0, end);
- end -= 1
- }
- return arr;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-insertion-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-insertion-sort.md
deleted file mode 100644
index 4eb3d2fe52..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-insertion-sort.md
+++ /dev/null
@@ -1,85 +0,0 @@
----
-id: 5a23c84252665b21eecc8009
-title: Sorting algorithms/Insertion sort
-challengeType: 5
----
-
-## Description
-
-An O(n2) sorting algorithm which moves elements one at a time into the correct position. The algorithm consists of inserting one element at a time into the previously sorted part of the array, moving higher ranked elements up as necessary. To start off, the first (or smallest, or any arbitrary) element of the unsorted array is considered to be the sorted part.
-Although insertion sort is an O(n2) algorithm, its simplicity, low overhead, good locality of reference and efficiency make it a good choice in two cases:
-(i) small n,
-(ii) as the final finishing-off algorithm for O(n logn) algorithms such as mergesort and quicksort.
-The algorithm is as follows (from wikipedia):
-
-function insertionSort(array A)
- for i from 1 to length[A]-1 do
- value := A[i]
- j := i-1
- while j >= 0 and A[j] > value do
- A[j+1] := A[j]
- j := j-1
- done
- A[j+1] = value
- done
-
-Write a function that performs insertion sort on a given array. The function should return the sorted array.
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: insertionSort
should be a function.
- testString: assert(typeof insertionSort == 'function', 'insertionSort
should be a function.');
- - text: insertionSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(insertionSort([25, 32, 12, 7, 20])), 'insertionSort([25, 32, 12, 7, 20])
should return a array.');
- - text: insertionSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(insertionSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'insertionSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: insertionSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(insertionSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'insertionSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: insertionSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(insertionSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'insertionSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: insertionSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(insertionSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'insertionSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: insertionSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(insertionSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'insertionSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function insertionSort (a) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function insertionSort (a) {
- for (var i = 0; i < a.length; i++) {
- var k = a[i];
- for (var j = i; j > 0 && k < a[j - 1]; j--)
- a[j] = a[j - 1];
- a[j] = k;
- }
- return a;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-merge-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-merge-sort.md
deleted file mode 100644
index e56224c181..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-merge-sort.md
+++ /dev/null
@@ -1,132 +0,0 @@
----
-id: 5a23c84252665b21eecc800a
-title: Sorting algorithms/Merge sort
-challengeType: 5
----
-
-## Description
-
-The merge sort is a recursive sort of order n*log(n).
-It is notable for having a worst case and average complexity of O(n*log(n)), and a best case complexity of O(n) (for pre-sorted input).
-The basic idea is to split the collection into smaller groups by halving it until the groups only have one element or no elements (which are both entirely sorted groups).
-Then merge the groups back together so that their elements are in order.
-This is how the algorithm gets its divide and conquer description.
-Write a function to sort a collection of integers using the merge sort. The function should return the sorted array.
-The merge sort algorithm comes in two parts: a sort function and a merge function
-The functions in pseudocode look like this:
-
-function mergesort(m)
- var list left, right, result
- if length(m) ≤ 1
- return m
- else
- var middle = length(m) / 2
- for each x in m up to middle - 1
- add x to left
- for each x in m at and after middle
- add x to right
- left = mergesort(left)
- right = mergesort(right)
- if last(left) ≤ first(right)
- append right to left
- return left
- result = merge(left, right)
- return result
-function merge(left,right)
- var list result
- while length(left) > 0 and length(right) > 0
- if first(left) ≤ first(right)
- append first(left) to result
- left = rest(left)
- else
- append first(right) to result
- right = rest(right)
- if length(left) > 0
- append rest(left) to result
- if length(right) > 0
- append rest(right) to result
- return result
-
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: mergeSort
should be a function.
- testString: assert(typeof mergeSort == 'function', 'mergeSort
should be a function.');
- - text: mergeSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(mergeSort([25, 32, 12, 7, 20])), 'mergeSort([25, 32, 12, 7, 20])
should return a array.');
- - text: mergeSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(mergeSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'mergeSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: mergeSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(mergeSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'mergeSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: mergeSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(mergeSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'mergeSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: mergeSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(mergeSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'mergeSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: mergeSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(mergeSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'mergeSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function mergeSort (array) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function mergeSort (array) {
- function merge(left, right, arr) {
- var a = 0;
-
- while (left.length && right.length) {
- arr[a++] = (right[0] < left[0]) ? right.shift() : left.shift();
- }
- while (left.length) {
- arr[a++] = left.shift();
- }
- while (right.length) {
- arr[a++] = right.shift();
- }
- }
-
- function mergeSortRecurse(arr) {
- var len = arr.length;
-
- if (len === 1) {
- return;
- }
-
- var mid = Math.floor(len / 2),
- left = arr.slice(0, mid),
- right = arr.slice(mid);
-
- mergeSortRecurse(left);
- mergeSortRecurse(right);
- merge(left, right, arr);
- }
- mergeSortRecurse(array)
- return array;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-quicksort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-quicksort.md
deleted file mode 100644
index ce6b98485b..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-quicksort.md
+++ /dev/null
@@ -1,156 +0,0 @@
----
-id: 5a23c84252665b21eecc800d
-title: Sorting algorithms/Quicksort
-challengeType: 5
----
-
-## Description
-
-Write a function to sort an array elements using the quicksort algorithm. The function should return the sorted array.
-The elements must have a strict weak order and the index of the array can be of any discrete type.
-Quicksort, also known as partition-exchange sort, uses these steps.
-
- - Choose any element of the array to be the pivot.
- - Divide all other elements (except the pivot) into two partitions.
-
- - All elements less than the pivot must be in the first partition.
- - All elements greater than the pivot must be in the second partition.
-
- - Use recursion to sort both partitions.
- - Join the first sorted partition, the pivot, and the second sorted partition.
-
-The best pivot creates partitions of equal length (or lengths differing by 1).
-The worst pivot creates an empty partition (for example, if the pivot is the first or last element of a sorted array).
-The run-time of Quicksort ranges from O(n log n) with the best pivots, to O(n2) with the worst pivots, where n is the number of elements in the array.
-This is a simple quicksort algorithm, adapted from Wikipedia.
-
-function quicksort(array)
- less, equal, greater := three empty arrays
- if length(array) > 1
- pivot := select any element of array
- for each x in array
- if x < pivot then add x to less
- if x = pivot then add x to equal
- if x > pivot then add x to greater
- quicksort(less)
- quicksort(greater)
- array := concatenate(less, equal, greater)
-
-A better quicksort algorithm works in place, by swapping elements within the array, to avoid the memory allocation of more arrays.
-
-function quicksort(array)
- if length(array) > 1
- pivot := select any element of array
- left := first index of array
- right := last index of array
- while left ≤ right
- while array[left] < pivot
- left := left + 1
- while array[right] > pivot
- right := right - 1
- if left ≤ right
- swap array[left] with array[right]
- left := left + 1
- right := right - 1
- quicksort(array from first index to right)
- quicksort(array from left to last index)
-
-Quicksort has a reputation as the fastest sort. Optimized variants of quicksort are common features of many languages and libraries. One often contrasts quicksort with merge sort, because both sorts have an average time of O(n log n).
-
- "On average, mergesort does fewer comparisons than quicksort, so it may be better when complicated comparison routines are used. Mergesort also takes advantage of pre-existing order, so it would be favored for using sort() to merge several sorted arrays. On the other hand, quicksort is often faster for small arrays, and on arrays of a few distinct values, repeated many times." — http://perldoc.perl.org/sort.html
-
-Quicksort is at one end of the spectrum of divide-and-conquer algorithms, with merge sort at the opposite end.
-
- - Quicksort is a conquer-then-divide algorithm, which does most of the work during the partitioning and the recursive calls. The subsequent reassembly of the sorted partitions involves trivial effort.
- - Merge sort is a divide-then-conquer algorithm. The partioning happens in a trivial way, by splitting the input array in half. Most of the work happens during the recursive calls and the merge phase.
-
-With quicksort, every element in the first partition is less than or equal to every element in the second partition. Therefore, the merge phase of quicksort is so trivial that it needs no mention!
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: quickSort
should be a function.
- testString: assert(typeof quickSort == 'function', 'quickSort
should be a function.');
- - text: quickSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(quickSort([25, 32, 12, 7, 20])), 'quickSort([25, 32, 12, 7, 20])
should return a array.');
- - text: quickSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(quickSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'quickSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: quickSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(quickSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'quickSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: quickSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(quickSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'quickSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: quickSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(quickSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'quickSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: quickSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(quickSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'quickSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function quickSort (array) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function quickSort (array) {
-
- function swap(i, j) {
- var t = array[i];
- array[i] = array[j];
- array[j] = t;
- }
-
- function quicksort(left, right) {
-
- if (left < right) {
- var pivot = array[left + Math.floor((right - left) / 2)],
- left_new = left,
- right_new = right;
-
- do {
- while (array[left_new] < pivot) {
- left_new += 1;
- }
- while (pivot < array[right_new]) {
- right_new -= 1;
- }
- if (left_new <= right_new) {
- swap(left_new, right_new);
- left_new += 1;
- right_new -= 1;
- }
- } while (left_new <= right_new);
-
- quicksort(left, right_new);
- quicksort(left_new, right);
-
- }
- }
-
- quicksort(0, array.length - 1);
-
- return array;
-}
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-radix-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-radix-sort.md
deleted file mode 100644
index 386453d39c..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-radix-sort.md
+++ /dev/null
@@ -1,84 +0,0 @@
----
-id: 5a23c84252665b21eecc800e
-title: Sorting algorithms/Radix sort
-challengeType: 5
----
-
-## Description
-
-Write a function to sort an integer array with the radix sort algorithm. The function should return the sorted array.
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: radixSort
should be a function.
- testString: assert(typeof radixSort == 'function', 'radixSort
should be a function.');
- - text: radixSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(radixSort([25, 32, 12, 7, 20])), 'radixSort([25, 32, 12, 7, 20])
should return a array.');
- - text: radixSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(radixSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'radixSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: radixSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(radixSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'radixSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: radixSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(radixSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'radixSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: radixSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(radixSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'radixSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: radixSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(radixSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'radixSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function radixSort (old) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function radixSort (old) {
- for (var shift = 52; shift > -1; shift--) {
- var tmp = (function(s) {
- var a = [];
- while (s-- > 0)
- a.push(0);
- return a;
- })(old.length);
- var j = 0;
- for (var i = 0; i < old.length; i++) {
- var move = old[i] << shift >= 0;
- if (shift === 0 ? !move : move) {
- tmp[j] = old[i];
- j++;
- } else {
- old[i - j] = old[i];
- }
- };
- for (var i = j; i < tmp.length; i++) {
- tmp[i] = old[i - j];
- };
- old = tmp;
- };
- return old;
-};
-```
-
-
diff --git a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-selection-sort.md b/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-selection-sort.md
deleted file mode 100644
index 3d39ee37aa..0000000000
--- a/curriculum/challenges/english/08-coding-interview-prep/rosetta-code/sorting-algorithms-selection-sort.md
+++ /dev/null
@@ -1,81 +0,0 @@
----
-id: 5a23c84252665b21eecc800f
-title: Sorting algorithms/Selection sort
-challengeType: 5
----
-
-## Description
-
-Write a function to sort an array (or list) of elements using the Selection sort algorithm. The function should return the sorted array.
-It works as follows:
-First find the smallest element in the array and exchange it with the element in the first position, then find the second smallest element and exchange it with the element in the second position, and continue in this way until the entire array is sorted.
-Its asymptotic complexity is O(n2) making it inefficient on large arrays.
-Its primary purpose is for when writing data is very expensive (slow) when compared to reading, eg. writing to flash memory or EEPROM.
-No other sorting algorithm has less data movement.
-
-
-## Instructions
-
-
-## Tests
-
-
-``` yml
-tests:
- - text: selectionSort
should be a function.
- testString: assert(typeof selectionSort == 'function', 'selectionSort
should be a function.');
- - text: selectionSort([25, 32, 12, 7, 20])
should return a array.
- testString: assert(Array.isArray(selectionSort([25, 32, 12, 7, 20])), 'selectionSort([25, 32, 12, 7, 20])
should return a array.');
- - text: selectionSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.
- testString: assert.deepEqual(selectionSort([25, 32, 12, 7, 20]), [7, 12, 20, 25, 32], 'selectionSort([25, 32, 12, 7, 20])
should return [7, 12, 20, 25, 32]
.');
- - text: selectionSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.
- testString: assert.deepEqual(selectionSort([38, 45, 35, 8, 13]), [8, 13, 35, 38, 45], 'selectionSort([38, 45, 35, 8, 13])
should return [8, 13, 35, 38, 45]
.');
- - text: selectionSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.
- testString: assert.deepEqual(selectionSort([43, 36, 20, 34, 24]), [20, 24, 34, 36, 43], 'selectionSort([43, 36, 20, 34, 24])
should return [20, 24, 34, 36, 43]
.');
- - text: selectionSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.
- testString: assert.deepEqual(selectionSort([12, 33, 26, 18, 1, 16, 38]), [1, 12, 16, 18, 26, 33, 38], 'selectionSort([12, 33, 26, 18, 1, 16, 38])
should return [1, 12, 16, 18, 26, 33, 38]
.');
- - text: selectionSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.
- testString: assert.deepEqual(selectionSort([3, 39, 48, 16, 1, 4, 29]), [1, 3, 4, 16, 29, 39, 48], 'selectionSort([3, 39, 48, 16, 1, 4, 29])
should return [1, 3, 4, 16, 29, 39, 48]
.');
-```
-
-
-
-## Challenge Seed
-
-
-
-```js
-function selectionSort (nums) {
- // Good luck!
-}
-```
-
-
-
-
-## Solution
-
-
-```js
-function selectionSort (nums) {
- var len = nums.length;
- for(var i = 0; i < len; i++) {
- var minAt = i;
- for(var j = i + 1; j < len; j++) {
- if(nums[j] < nums[minAt])
- minAt = j;
- }
-
- if(minAt != i) {
- var temp = nums[i];
- nums[i] = nums[minAt];
- nums[minAt] = temp;
- }
- }
- return nums;
-}
-```
-
-