This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const URL = "https://jsonplaceholder.typicode.com/users" | |
class Http { | |
get(url, headers) { | |
return makeRequest('GET', url, headers) | |
} | |
post(url, headers, body) { | |
return makeRequest('POST', url, headers, body) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Итеративный подход | |
function binarySearch (array, element) { | |
let start = 0 | |
let end = array.length | |
let middle | |
let found = false | |
let position = -1 | |
while (found === false && start <= end) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function linearSearch(array, element) { | |
for (let i = 0; i < array.length; i++) { | |
if (array[i] === element) { | |
return i | |
} | |
} | |
return null | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function selectionSort (array) { | |
for (let i = 0; i < array.length; i++) { | |
let minIndex = i | |
for (let j = i + 1; j < array.length; j++) { | |
if(array[j] < array[minIndex]) { | |
minIndex = j | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bubbleSearch (array) { | |
for (let i = 0; i < array.length; i++) { | |
for (let j = 0; j < array.length; j++) { | |
if (array[j + 1] < array[j]) { | |
let tmp = array[j] | |
array[j] = array[j + 1] | |
array[j + 1] = tmp | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function quickSort (array) { | |
if (array.length <= 1) { | |
return array | |
} | |
let pivotIndex = Math.floor(array.length / 2) | |
let pivotElement = array[pivotIndex] | |
let leftArray = [] | |
let rightArray = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const factorial = (n) => { | |
if (n === 1) { | |
return 1 | |
} | |
return n * factorial(n - 1) | |
} | |
const fibonacci = (n) => { | |
if (n === 1 || n === 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am mickeyzzz on github. | |
* I am mikcey_zzz (https://keybase.io/mikcey_zzz) on keybase. | |
* I have a public key ASCagDZ0Q7HsKsPNUV04n2Xln6rrAvfH7XA-cnW1CSG1Vwo | |
To claim this, I am signing this object: |