ALGORITHM/자료구조

    Priority Queue (우선순위 큐) / JS

    // PriorityQueue에 삽입 될 자료구조 class QElement { constructor(element, priority) { this.element = element; this.priority = priority; } } class PriorityQueue { constructor() { this.queue = []; } // element, priority 삽입 enqueue(element, priority) { const qElement = new QElement(element, priority); let isContain = false; for(let i=0; i qElement.priority) { // i번째에 삽입 this.queue.splice(i, 0, qElement); i..