Skip to content

Commit b1f30b5

Browse files
author
Isaac Ramirez
committed
- minor updates
1 parent ed9bbaa commit b1f30b5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/algorithms/heap-sort/heap-sort.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ class Heap extends GenericSort {
3939
* @param {ComparatorFn} [comparator] - The comparator function.
4040
*/
4141
static sink (a, k, n, comparator) {
42+
let j
43+
4244
while (2 * k <= n) {
43-
let j = 2 * k
45+
j = 2 * k
4446

4547
// decrement indices by 1 so the array
4648
// can be sorted from a[0] to a[n - 1]

src/examples/test-clients/sort-compare.client.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ class SortCompare {
122122

123123
algorithms[sortName].sort(a)
124124

125-
return timer.elapsedTime()
125+
const elapsedTime = timer.elapsedTime()
126+
127+
algorithms[sortName].isSorted(a)
128+
129+
return elapsedTime
126130
}
127131

128132
/**

0 commit comments

Comments
 (0)