Skip to main content

Some widely used data structures

Project description


Python implementation of abstract data structures


pip install py-data-structures

Data Structures Covered:



from data_structures import Stack

stack = Stack()
stack.push(item)  # push an item in stack
stack.pop()  # returns and removes the top item from the stack
stack.length  # contains the length of the stack  # contains the top item of the stack

stack.iterate()  # override to iterate or perform action on the stack elements


from data_structures import exceptions

# raised on pop() or top when stack is empty



from data_structures import Queue

queue = Queue()
queue.enqueue(item)  # add an item at the end of queue
queue.dequeue()  # returns and removes the first item from the queue
queue.length  # contains the length of the queue
queue.first_item  # contains the first item in the queue
queue.last_item  # contains the last item in the queue

queue.iterate()  # override to iterate or perform action on the queue elements


from data_structures import exceptions

# raised on dequeue(), first_item or last_item when queue is empty

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-data-structures, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size py-data-structures-0.2.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page