We followed the runtimes given by the Java API Subset found here.
void add(String s)
A String is appended to the end of the ArrayPriorityQueue, which has a runtime of O(1).
boolean isEmpty()
Returns whether or not the ArrayPriorityQueue is empty, determined through _size, which has a runtime of O(1).
String peekMin()
Iterates through the ArrayPriorityQueue to find the string of smallest value using .compareTo, which has a runtime of O(n).
String removeMin()
Iterates through the ArrayPriorityQueue to find the string of smallest value using .compareTo, and removing it. This has a runtime of O(n) as well.
- isEmpty()/peekMin() -- these two methods seem the most easy to implement
- minChildPos(int) -- this method is a helper function to removeMin, meaning it is essential to the implementation of it
- toString() -- would help testing
- removeMin()/add(Integer) -- the central focus of the works