-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMinHeap.java
47 lines (40 loc) · 829 Bytes
/
MinHeap.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* API of the MaxHeap
*
* @author Miguel Stephane KAKANAKOU
*
*/
public interface MinHeap<Key extends Comparable<Key>> {
/**
* Insert a new element in the Heap
*
* @param v Key to be inserted in the Heap
*/
public void insert(Key v);
/**
* Delete and return the min element in the Heap
*
* @return the min in the Heap
*
* @throws java.util.NoSuchElementException if the Heap is empty
*/
public Key delMin();
/**
* Check if the Heap is empty
*
* @return true is the Heap is empty and false if not
*/
public boolean isEmpty();
/**
* Return the min element in the Heap
*
* @return the min Key in the Heap
*
* @throws java.util.NoSuchElementException if the Heap is empty
*/
public Key min();
/**
* @return the size of the Heap
*/
public int size();
}