mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-25 07:17:23 +08:00
impr(quotes): add JavaScript quote (NipulM) (#5099)
This commit is contained in:
parent
9017312a95
commit
bebd11a35e
1 changed files with 6 additions and 0 deletions
|
|
@ -276,6 +276,12 @@
|
|||
"source": "Monkeytype Sourcecode",
|
||||
"length": 159,
|
||||
"id": 45
|
||||
},
|
||||
{
|
||||
"text": "function swap(arr, xp, yp) {\n\tvar temp = arr[xp];\n\tarr[xp] = arr[yp];\n\tarr[yp] = temp;\n}\n\nfunction selectionSort(arr, n) {\n\tvar i , j, min_idx;\n\n\tfor(i = 0; i < n -1; i++){\n\t\tmin_idx = i;\n\n\t\tfor(j = i + 1; j < n; j++)\n\t\tif(arr[j] < arr[min_idx])\n\t\t\tmin_idx = j;\n\n\t\tswap(arr, min_idx, i)\n\t}\n}\n\nfunction printArray(arr, size) {\n\tvar i;\n\tvar result = \"\";\n\tfor(i = 0; i < size; i++)\n\tresult += arr[i] + \" \";\n\tdocument.write(`Sorted array: ${result}`);\n\treturn console.log(`Sorted array: ${result}`);\t\t\n}",
|
||||
"source": "Selection Sort",
|
||||
"length": 499,
|
||||
"id": 46
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue