Skip to content

sankethkatta/PriorityQueue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Persistent Priority Queue

A persistent priority queue base with FIFO Queue and LIFO Stack structures.

Priority Queue

from priorityqueue import PriorityQueue

pq = PriorityQueue("mypq")

pq.push(priority=1, item="world")
pq.push(priority=2, item="hello")

while not pq.is_empty():
    print pq.pop()

# hello
# world

FIFO Queue

from priorityqueue import Queue

q = Queue("myppq")

q.push("hello")
q.push("world")

while not q.is_empty():
    print q.pop()

# hello
# world

LIFO Stack

from priorityqueue import Stack

s = Stack("myppq")

s.push("world")
s.push("hello")

while not s.is_empty():
    print s.pop()

# hello
# world

Unit Tests

python test_priorityqueue.python -v

About

A Persistent (Priority) Queue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages