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
```<br>

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.2.tar.gz (3.3 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: py-data-structure-0.1.2.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for py-data-structure-0.1.2.tar.gz
Algorithm Hash digest
SHA256 abe031d9d606eb1eedeb6e80e9afd521db921b777ecb08051ea20382bc911cd9
MD5 132cf70a5f097832eefeb0356c6b3c36
BLAKE2b-256 70137d6c724319252170818fa40c3977309b58cd48727930504f0b2151c737a8

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