Skip to content

Commit 6507cbf

Browse files
committed
sort/
1 parent 9d4349c commit 6507cbf

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Sorts/bogoSort.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* A simple helper function that checks, if the array is
33
* sorted in ascending order.
44
*/
5+
6+
/* eslint no-extend-native: ["off", { "exceptions": ["Object"] }] */
57
Array.prototype.isSorted = function () {
68
const length = this.length
79

Sorts/heapSort.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* Build a max heap out of the array. A heap is a specialized tree like
3-
* data structure that satisfies the heap property. The heap property
4-
* for max heap is the following: "if P is a parent node of C, then the
5-
* key (the value) of node P is greater than the key of node C"
6-
* Source: https://en.wikipedia.org/wiki/Heap_(data_structure)
7-
*/
8-
2+
* Build a max heap out of the array. A heap is a specialized tree like
3+
* data structure that satisfies the heap property. The heap property
4+
* for max heap is the following: "if P is a parent node of C, then the
5+
* key (the value) of node P is greater than the key of node C"
6+
* Source: https://en.wikipedia.org/wiki/Heap_(data_structure)
7+
*/
8+
/* eslint no-extend-native: ["off", { "exceptions": ["Object"] }] */
99
Array.prototype.heapify = function (index, heapSize) {
1010
let largest = index
1111
const leftIndex = 2 * index + 1
@@ -29,10 +29,10 @@ Array.prototype.heapify = function (index, heapSize) {
2929
}
3030

3131
/*
32-
* Heap sort sorts an array by building a heap from the array and
33-
* utilizing the heap property.
34-
* For more information see: https://en.wikipedia.org/wiki/Heapsort
35-
*/
32+
* Heap sort sorts an array by building a heap from the array and
33+
* utilizing the heap property.
34+
* For more information see: https://en.wikipedia.org/wiki/Heapsort
35+
*/
3636
function heapSort (items) {
3737
const length = items.length
3838

Sorts/wiggleSort.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*
55
*/
66

7+
/* eslint no-extend-native: ["off", { "exceptions": ["Object"] }] */
78
Array.prototype.wiggleSort = function () {
89
for (let i = 0; i < this.length; ++i) {
910
const shouldNotBeLessThan = i % 2

0 commit comments

Comments
 (0)