Skip to content

Commit aee4fcc

Browse files
author
Vitalii Telychko
committed
added text info
1 parent f5d1db5 commit aee4fcc

File tree

10 files changed

+38
-26
lines changed

10 files changed

+38
-26
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1. An algorithm is any well-defined computational procedure that takes
2+
some value, or set of values, as input and produces some value, or set of values, as
3+
output. An algorithm is thus a sequence of computational steps that transform the
4+
input into the output. The algorithm describes a specific computational procedure for achieving that input/output relationship.
5+
6+
2.
File renamed without changes.

data_structures/array/array.js

-18
This file was deleted.

data_structures/linkedList/linkedList.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function display() {
3333
currNode = currNode.next;
3434
}
3535
}
36+
3637
function findPrevious(item) {
3738
var currNode = this.head;
3839
while (!(currNode.next === null) && (currNode.next.element !== item)) {
@@ -54,4 +55,4 @@ cities.insert('RusselVille', 'Conway');
5455
cities.insert('Alma', 'RusselVille');
5556
cities.display();
5657
cities.find('Alma');
57-
console.log(cities);
58+
cities.display();

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
</head>
99
<body>
1010

11-
<script src="optimization_algorithms/dynamic_programming/the_knapsack_problem.js"></script>
11+
<script src="sorting_algorithms/quicksort.js"></script>
1212
</body>
1313
</html>

must_know

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
1. Шпаргалка по асимптотической сложности алгоритмов - https://habr.com/post/188010/.
2+
2. Метод доказательства по индукции - базовый случай / индукционный переход (принцип домино).

sorting_algorithms/insertionsort.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@ for(i = 0; i < size; i += 1) {
1515
j -= 1;
1616
}
1717
arr[j + 1] = temp;
18-
}
19-
20-
// console.log(arr);
18+
}

sorting_algorithms/mergesort.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
function mergeSort(arr) {
2-
if(arr.length === 1) {
3-
return arr;
4-
}
2+
if(arr.length === 1) return arr;
53

64
const middle = Math.floor(arr.length / 2),
75
left = arr.slice(0, middle),

sorting_algorithms/quicksort.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function quickSort(list) {
2+
var lesser = [], greater = [], pivot = list[0], i, size = list.length, item;
3+
if(size === 0) return [];
4+
for(i = 1; i < size; i += 1) {
5+
item = list[i];
6+
item < pivot ? lesser.push(item) : greater.push(item);
7+
}
8+
return quickSort(lesser).concat(pivot, quickSort(greater));
9+
}
10+
11+
const list = [2, 5, 1, 3, 7, 2, 3, 8, 6, 3];
12+
quickSort(list);

sorting_algorithms/shellsort.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// function shellSort() {
2+
// for (var g = 0; g < this.gaps.length; ++g) {
3+
// for (var i = this.gaps[g]; i < this.dataStore.length; ++i) {
4+
// var temp = this.dataStore[i];
5+
// for (var j = i; j >= this.gaps[g] && this.dataStore[j - this.gaps[g]] > temp; j -= this.gaps[g]) {
6+
// this.dataStore[j] = this.dataStore[j - this.gaps[g]];
7+
// }
8+
// this.dataStore[j] = temp;
9+
// }
10+
// }
11+
// }
12+
//
13+
// shellSort();

0 commit comments

Comments
 (0)