Skip to main content

A package that allows you to implement C++ data structures in Python.

Project description

Py Data Structure

Py data stucture makes it easier to use data structures with python. While you can perform these operations in different ways, py data structure makes it much easier to use many data structures which we can use in C++ but not in Python. You can use Stacks, and Queues in this module, however we will be adding more data structures like heaps.

Pypi Page: https://pypi.org/project/py-data-structure/

Github Page: https://github.com/tinyCodersDen/py-data-structure

See documentation below for the functions and how it works.

Installation:

pip install py-data-structure

Stacks:

from py_data_structure import Stack

Create a stack:

stack = Stack()

Push an element into a stack:

stack.push(element)

Pop/remove the top element from stack:

stack.pop()

Get the top element:

print(stack.top())

Get bottom element:

print(stack.bottom())

Get size of stack:

print(stack.size())

Check if stack is empty:

print(stack.isEmpty())

Get a list of stack values:

print(stack.get_stack())

Queues:

from py_data_structure import Queue

Create a queue:

queue = Queue()

Enqueue to a queue:

queue.enqueue(element)

Dequeue to a queue:

queue.dequeue()

Get the front element of a queue:

print(queue.front())

Get the back element of a queue:

print(queue.back())

Check if a queue is empty:

print(queue.isEmpty())

Get the size of a queue:

print(queue.size())

Get the whole queue in a list format:

print(queue.get_queue())

Project details


Download files

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

Source Distribution

py-data-structure-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file py-data-structure-0.1.1.tar.gz.

File metadata

  • Download URL: py-data-structure-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.1

File hashes

Hashes for py-data-structure-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b1bfc45c8c88eefba100268e2a78c0a6d49ac03d8512edec919707271846bab2
MD5 79066607582bbeeb95f44a6581e370b6
BLAKE2b-256 c0b06ee4419837345cc4528f71a2de5f28857d3bd73e4defbb0627fc3d200928

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page