Skip to content

Commit c2c0c92

Browse files
committed
Adding TODOs
1 parent 231b69d commit c2c0c92

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/data-structures/heaps/minHeap.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// TODO: Add unit test
2+
13
import BHNode from "./bHNode";
24

35
class MinHeap<T> {
@@ -67,7 +69,7 @@ class MinHeap<T> {
6769
} else {
6870
smallIdx = l;
6971
}
70-
// swap element from idx with greater
72+
// swap parent and smaller child
7173
[this.values[idx], this.values[smallIdx]] = [
7274
this.values[smallIdx],
7375
this.values[idx],
@@ -108,6 +110,7 @@ class MinHeap<T> {
108110
// In this case second param <keys> is not used
109111
// In any case the Heap is build in linear time
110112
// Returns: this Heap
113+
// TODO: static method
111114
buildHeap = (arr: number[] | Map<T, number>, keys: T[]) => {
112115
// Returns false if this heap is not empty
113116
if (!this.isEmpty()) return false;

src/dynamic-programming/sequenceAlignment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// TODO: needlemanWunsch implementation! already done in another repo
2+
13
// inputs: Stirng X and Y
24
// sigma for gap penalty
35
// Alpha: matrix for mismatch cost
@@ -15,7 +17,7 @@ const sq = (
1517

1618
// for empty strings
1719
for (let i = 0; i < m; i++) arr[i][0] = i * sigma;
18-
for (let j = 0; j < m; j++) arr[0][j] = j * sigma;
20+
for (let j = 0; j < n; j++) arr[0][j] = j * sigma;
1921

2022
// case 1: match cost + Xi-1 Yj-1
2123
// case 2: sigma + Xi-1 Yj

src/sort/heapSort.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import MinHeap from "../data-structures/heaps/minHeap";
22

3+
// TODO: use Heap interface so it's possible to use any heap implementation
4+
// EG, Fibonacci heap
35
const heapSort = (arr: number[]) => {
46
const minHeap = new MinHeap();
57
const result = [];

0 commit comments

Comments
 (0)