Skip to content

Instantly share code, notes, and snippets.

@st0le
Created May 5, 2013 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save st0le/5519890 to your computer and use it in GitHub Desktop.
Save st0le/5519890 to your computer and use it in GitHub Desktop.
Using PriorityQueue from Queue Module
import random,Queue
pq = Queue.PriorityQueue()
for q in range(10):
p = random.randint(0,100)
print "Inserting %d with priority %d" % (q,p)
pq.put((p,q))
while not pq.empty():
print pq.get()
raw_input()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment