@lydiahallie/

StaidBigheartedInstitution

Nodejs

No description

fork
loading
Files
  • index.js

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.561119709285322","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"CmZ1bmN0aW9uIGluc2VydGlvblNvcnQoYXJyYXkpIHsKICBmb3IgKGxldCBpID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsgaSsrKSB7CiAgICBsZXQgdGVtcCA9IGFycmF5W2ldCiAgICBsZXQgaiA9IGkgLSAxCiAgICB3aGlsZSAoaiA+PSAwICYmIGFycmF5W2pdID4gdGVtcCkgewogICAgICBhcnJheVtqICsgMV0gPSBhcnJheVtqXQogICAgICBqLS0KICAgIH0KICAgIGFycmF5W2ogKyAxXSA9IHRlbXAKICB9CiAgcmV0dXJuIGFycmF5Cn0KCmluc2VydGlvblNvcnQoWzksIDUsIDEwLCA4LCAyXSk="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function insertionSort(array) {
  for (let i = 0; i < array.length; i++) {
    let temp = array[i]
    let j = i - 1
    while (j >= 0 && array[j] > temp) {
      array[j + 1] = array[j]
      j--
    }
    array[j + 1] = temp
  }
  return array
}

insertionSort([9, 5, 10, 8, 2])
node v10.16.0