Queue and PriorityQueue

even though those two things are pretty similar by the names, they are implement is totally different

queue can be implemented using array/arrayList or doublely Linked List. (and it can also be implement by stack…although stack is also based on array or linkedList)

but priorityqueue is not all about the order of elment put in pq, it has something to do with the value. so pq needs to be implemented by heap, so that means we need to use complete binary thee/Array, and when we need to maintain this pq, we need to heaplify up or heaplify down.

posted @ 2020-05-17 13:52  EvanMeetTheWorld  阅读(22)  评论(0)    收藏  举报