Skip to main content

cqueue

PyPI version License: MIT

This library was created to make the concept of a queue easier by visualizing it and showing how items enter and exit it, especially for beginners in data structures

Installation

You can install cqueue via pip:

pip install cqueue

Usage

For Circular Queue

from cqueue import circularQueue

x = circularQueue(capacity=7)
print(x)

Output

[]

You Can Visualize The Queue With All Details

from cqueue import circularQueue

x = circularQueue(capacity=7, detail=True)
print(x)

Output

╒═════════╤══╤══╤══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │  │  │  │  │  │  │  │ <- ENTER │
╘═════════╧══╧══╧══╧══╧══╧══╧══╧══════════╛

Enqueue

from cqueue import circularQueue

x = circularQueue(capacity=7, detail=True)
print(x)
x.enqueue(1)
x.enqueue(2)
x.enqueue(3)
print(x)

Output

╒═════════╤══╤══╤══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │  │  │  │  │  │  │  │ <- ENTER │
╘═════════╧══╧══╧══╧══╧══╧══╧══╧══════════╛
╒═════════╤═══╤═══╤═══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │  │  │  │  │ <- ENTER │
╘═════════╧═══╧═══╧═══╧══╧══╧══╧══╧══════════╛

Dequeue

from cqueue import circularQueue

x = circularQueue([1, 2, 3], capacity=7, detail=True)
print(x)
x.dequeue()
print(x)

Output

╒═════════╤═══╤═══╤═══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │ 1 │ 2 │ 3 │  │  │  │  │ <- ENTER │
╘═════════╧═══╧═══╧═══╧══╧══╧══╧══╧══════════╛
╒═════════╤═══╤═══╤══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │ 2 │ 3 │  │  │  │  │  │ <- ENTER │
╘═════════╧═══╧═══╧══╧══╧══╧══╧══╧══════════╛

You Can Check If The Queue Is Empty Or Not

from cqueue import circularQueue

x = circularQueue(capacity=7, detail=True)
print(x.isEmpty())

Output

True

You Can Check If The Queue Is Full Or Not

from cqueue import circularQueue

x = circularQueue([1, 2, 3, 4, 5, 6, 7], capacity=7, detail=True)
print(x.isFull())

Output

True

You Can See The Item Who Can EXIT From The Queue Using peek Or top

from cqueue import circularQueue

x = circularQueue([5, 6, 7], capacity=7, detail=True)
print(x.peek())
print(x.top())

Output

5
5

You Can See How Many Items Are In The Queue Using len Function

from cqueue import circularQueue

x = circularQueue([5, 6, 7], capacity=7, detail=True)
print(len(x))

Output

3

You Can Clear The Queue

from cqueue import circularQueue

x = circularQueue([5, 6, 7], capacity=7, detail=True)
print(x)
x.clear()
print(x)

Output

╒═════════╤═══╤═══╤═══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │ 5 │ 6 │ 7 │  │  │  │  │ <- ENTER │
╘═════════╧═══╧═══╧═══╧══╧══╧══╧══╧══════════╛
╒═════════╤══╤══╤══╤══╤══╤══╤══╤══════════╕
│ <- EXIT │  │  │  │  │  │  │  │ <- ENTER │
╘═════════╧══╧══╧══╧══╧══╧══╧══╧══════════╛

For Linked Circular Queue

You can use linkedCircularQueue with the same syntax as circularQueue with all previous methods the main difference is circularQueue use static array(list) and linkedCircularQueue use static circular singly linked list

License

This project is licensed under the MIT LICENSE - see the LICENSE for more details.

Metadata

Release files for cqueue 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cqueue 1.1.2
File Size Uploaded Provenance Actions
cqueue-1.1.2.tar.gz 4.6 kB Without provenance Details for cqueue-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cqueue 1.1.2
File Interpreter ABI Platform Actions
cqueue-1.1.2-py3-none-any.whl Python 3 none any Details for cqueue-1.1.2-py3-none-any.whl

Total release size: 9.9 kB

Release files / cqueue-1.1.2.tar.gz

Download URL cqueue-1.1.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
eb6b6943feb508b7fc6535ba1065e1662193324152cca0e6d909421202cc03d0
BLAKE2b-256 checksum
How to use checksums
859da71ee234774b51c4a5b333b127993cfa24af14f050ee1d48db6727b2a09f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / cqueue-1.1.2-py3-none-any.whl

Download URL cqueue-1.1.2-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
77e956e35e2574628acc5973b7dd7257f74c0869452165ed0eb6da2e2c76450b
BLAKE2b-256 checksum
How to use checksums
1d81aa0f989b4a2407bcab10cb56861bcd068c933ebd211bada808452d80f1c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Security for cqueue 1.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page