Skip to content

Commit

Permalink
fix(learn): typo in "Priority Queue" description (#38804)
Browse files Browse the repository at this point in the history
  • Loading branch information
TyMick committed May 28, 2020
1 parent 0bbbd16 commit 3b65bc8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ forumTopicId: 301630
In this challenge you will be creating a Priority Queue. A Priority Queue is a special type of Queue in which items may have additional information which specifies their priority. This could be simply represented with an integer. Item priority will override placement order in determining the sequence items are dequeued. If an item with a higher priority is enqueued after items with lower priority, the higher priority item will be dequeued before all the others.
For instance, let’s imagine we have a priority queue with three items:
<code>[['kitten', 2], ['dog', 2], ['rabbit', 2]]</code>
Here the second value (an integer) represents item priority. If we enqueue <code>['human', 1]</code> with a priority of <code>1</code> (assuming lower priorities are given precedence) it would then be the first item to be dequeued. The collection would like this:
Here the second value (an integer) represents item priority. If we enqueue <code>['human', 1]</code> with a priority of <code>1</code> (assuming lower priorities are given precedence) it would then be the first item to be dequeued. The collection would look like this:
<code>[['human', 1], ['kitten', 2], ['dog', 2], ['rabbit', 2]]</code>.
We’ve started writing a <code>PriorityQueue</code> in the code editor. You will need to add an <code>enqueue</code> method for adding items with a priority, a <code>dequeue</code> method for removing items, a <code>size</code> method to return the number of items in the queue, a <code>front</code> method to return the element at the front of the queue, and finally an <code>isEmpty</code> method that will return <code>true</code> if the queue is empty or <code>false</code> if it is not.
The <code>enqueue</code> should accept items with the format shown above (<code>['human', 1]</code>) where <code>1</code> represents the priority. The <code>dequeue</code> should return only the current item, not its priority.
Expand Down

0 comments on commit 3b65bc8

Please sign in to comment.