Skip to content

Commit ef3a446

Browse files
authored
Update DerpySort.js
1 parent 67dcf83 commit ef3a446

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Sorts/DerpySort.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
// This sorting function called derpy randomly removes and re-adds elements in order
1+
/* Derpy Sort is an algorithm to randomly sort an array. It
2+
* randomly removes and re-adds elements in an array.
3+
4+
* The big O on the Derpy Sort is O(N).
5+
*
6+
* In the Derpy Sort, we iterate through the length of the array and select a random
7+
* index. We then remove the element associated with that index and re-add it to the
8+
* end of the array. After the length of the array has been iterated through, the
9+
* function then returns the resulting array.
10+
*
11+
* This sorting function is impractical and does not provide any purpose other than
12+
* creating a jumbled mess.
13+
*/
214

315
function derpySort(arr) {
416

0 commit comments

Comments
 (0)