-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaxHeap.java
49 lines (40 loc) · 834 Bytes
/
MaxHeap.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
48
49
/**
* API of the MaxHeap
*
* @author Miguel Stephane KAKANAKOU
*
*/
public interface MaxHeap<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 max element in the Heap
*
* @return the max in the Heap
*
* @throws java.util.NoSuchElementException if the Heap is empty
*/
public Key delMax();
/**
* Check if the Heap is empty
*
* @return true is the Heap is empty and false if not
*/
public boolean isEmpty();
/**
* Return the max element in the Heap
*
* @return the max Key in the Heap
*
* @throws java.util.NoSuchElementException if the Heap is empty
*/
public Key max();
/**
* @return the size of the Heap
*/
public int size();
}