Don't use in production!!! For development purpose only
- Create compose.yml file with the following content:
services:
mongodb:
image: mongo
container_name: mongodb
volumes:
- mongodb:/data/db
Don't use in production!!! For development purpose only
services:
mongodb:
image: mongo
container_name: mongodb
volumes:
- mongodb:/data/db
/** | |
* Insertion sort | |
* @param {array} arr - Array of numbers | |
*/ | |
const insertionSort = (arr = []) => { | |
const length = arr.length; | |
for (let i = 1; i < length; i++) { | |
const item = arr[i]; | |
let j = i - 1; |
/** | |
* Bubble sort | |
* @param {array} arr - Array of numbers | |
*/ | |
const bubbleSort = (arr = []) => { | |
const length = arr.length; | |
for (let i = 0; i < length; i++) { | |
for (let j = 0; j < length - i; j++) { | |
const tmp = arr[j + 1]; |
/** | |
* Quick sort | |
* @param {array} list - Array of numbers | |
* @returns {array} - Sorted array | |
*/ | |
const quickSort = (list) => { | |
if (list.length < 2) { | |
return list; | |
} |
/** | |
* Find the index of the smallest element of the array | |
* @param {array} list - Array of numbers | |
* @returns {number} - Index | |
*/ | |
const findMinItemIndex = list => { | |
let minIndex = 0; | |
let minItem = list[0]; | |
const length = list.length; |
/** | |
* Binary search | |
* @param {array} list - Array of numbers for search | |
* @param {number} elem - Looking item | |
* @returns {number|null} - Found index or null if not found | |
*/ | |
const binarySearch = (list, elem) => { | |
let startIndex = 0; | |
let lastIndex = list.length - 1; |