Package minpq
Class UnsortedArrayMinPQ<E>
- java.lang.Object
- 
- minpq.UnsortedArrayMinPQ<E>
 
- 
- 
Field SummaryFields Modifier and Type Field Description private List<PriorityNode<E>>elementsListofPriorityNodeobjects representing the element-priority pairs in no specific order.
 - 
Constructor SummaryConstructors Constructor Description UnsortedArrayMinPQ()Constructs an empty instance.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(E element, double priority)Adds an element with the given priority value.voidchangePriority(E element, double priority)Updates the given elements' associated priority value.booleancontains(E element)Returns true if the given element is in this priority queue.EpeekMin()Returns the element with the minimum priority value.EremoveMin()Returns and removes the element with the minimum priority value.intsize()Returns the number of elements in this priority queue.
 
- 
- 
- 
Field Detail- 
elementsprivate final List<PriorityNode<E>> elements ListofPriorityNodeobjects representing the element-priority pairs in no specific order.
 
- 
 - 
Method Detail- 
addpublic void add(E element, double priority) Description copied from interface:MinPQAdds an element with the given priority value.
 - 
containspublic boolean contains(E element) Description copied from interface:MinPQReturns true if the given element is in this priority queue.
 - 
peekMinpublic E peekMin() Description copied from interface:MinPQReturns the element with the minimum priority value.
 - 
removeMinpublic E removeMin() Description copied from interface:MinPQReturns and removes the element with the minimum priority value.
 - 
changePrioritypublic void changePriority(E element, double priority) Description copied from interface:MinPQUpdates the given elements' associated priority value.- Specified by:
- changePriorityin interface- MinPQ<E>
- Parameters:
- element- the element whose associated priority value should be modified.
- priority- the updated priority value.
 
 
- 
 
-