Skip to content

Commit 0588044

Browse files
committed
JS 알고리즘 강의 자료
1 parent 39456d3 commit 0588044

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

JS/06.그리디,우선순위 큐/test(06).js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class minHeap {
2222
}
2323
get() {
2424
if (this.heap.length === 2) return this.heap.pop();
25+
if (this.heap.length === 1) return false;
2526
let res = this.heap[1];
2627
this.heap[1] = this.heap.pop();
2728
this.downheap(1, this.heap.length - 1); // pos는 마지막 부모까지만 내려가야 한다.

JS/10.다이나믹프로그래밍/05.가방문제(냅색).js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function solution(arr, m) {
77
for (let i = 0; i < arr.length; i++) {
88
for (let j = arr[i][0]; j <= m; j++) {
99
dy[j] = Math.max(dy[j], dy[j - arr[i][0]] + arr[i][1]);
10+
console.log('here ', dy[j]);
1011
}
1112
}
1213
answer = dy[m];

0 commit comments

Comments
 (0)