如何在javascript中执行方法以返回priorityqueue前面的值而不从队列中删除此值
你能用评论写出来吗,因为我想逐步理解 这是我对priorityqueue的初始代码
function PQueue()
{
this.pq = new List(); //requirement: linked-list implementation
// specify (design) methods
this.isEmpty = pqEmpty; //return true if queue empty
this.deleteMin = deleteMin; //remove/return item with minimum priority
this.insert = pqinsert; //insert item with priority
this.decrease = decrease; //updated the priority queue with the new distance value
}