Skip to content

Commit 6598658

Browse files
committed
feat: 쓸만한 배열 기반 힙 구현 시작
1 parent 95791db commit 6598658

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package heap;
2+
3+
import java.util.Comparator;
4+
5+
public class ArrayUsefulHeap<E> implements UsefulHeap<E> {
6+
7+
private static final int INITIAL_CAPACITY = 100 + 1;
8+
9+
private int numOfData;
10+
private Object[] heapArr;
11+
// 첫번째 인자가 크면 양수, 작으면 음수, 같으면 0을 반환한다.
12+
private Comparator<E> comp;
13+
14+
public ArrayUsefulHeap(Comparator<E> comparator) {
15+
this.heapArr = new Object[INITIAL_CAPACITY];
16+
this.comp = comparator;
17+
}
18+
19+
@Override
20+
public boolean isEmpty() {
21+
return this.numOfData == 0;
22+
}
23+
24+
@Override
25+
public void insert(E data) {
26+
27+
}
28+
29+
@Override
30+
public E delete() {
31+
return null;
32+
}
33+
34+
}

0 commit comments

Comments
 (0)