cqueue


Namecqueue JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://pypi.org/project/cqueue/
SummarySophisticate Circular Queue
upload_time2024-10-29 14:39:35
maintainerNone
docs_urlNone
authorkhiat Mohammed Abderrezzak
requires_python>=3.6
licenseMIT
keywords circular queue
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # cqueue


[![PyPI version](https://badge.fury.io/py/cqueue.svg)](https://badge.fury.io/py/cqueue)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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:


```bash
pip install cqueue
```


## Usage 


### For Circular Queue


```python
from cqueue import circularQueue

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


### Output


```bash
[]
```


#### You Can Visualize The Queue With All Details


```python
from cqueue import circularQueue

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


### Output


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


#### Enqueue


```python
from cqueue import circularQueue

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


### Output


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


#### Dequeue


```python
from cqueue import circularQueue

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


### Output


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


#### You Can Check If The Queue Is Empty Or Not


```python
from cqueue import circularQueue

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


### Output


```bash
True
```

#### You Can Check If The Queue Is Full Or Not


```python
from cqueue import circularQueue

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


### Output


```bash
True
```


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


```python
from cqueue import circularQueue

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


### Output


```bash
5
5
```


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


```python
from cqueue import circularQueue

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


### Output


```bash
3
```


#### You Can Clear The Queue


```python
from cqueue import circularQueue

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


### Output


```bash
╒═════════╤═══╤═══╤═══╤══╤══╤══╤══╤══════════╕
│ <- 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](https://opensource.org/licenses/MIT) for more details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/cqueue/",
    "name": "cqueue",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "circular queue",
    "author": "khiat Mohammed Abderrezzak",
    "author_email": "khiat.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/85/9d/a71ee234774b51c4a5b333b127993cfa24af14f050ee1d48db6727b2a09f/cqueue-1.1.2.tar.gz",
    "platform": null,
    "description": "# cqueue\n\n\n[![PyPI version](https://badge.fury.io/py/cqueue.svg)](https://badge.fury.io/py/cqueue)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\nThis 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\n\n\n## Installation\n\n\nYou can install `cqueue` via pip:\n\n\n```bash\npip install cqueue\n```\n\n\n## Usage \n\n\n### For Circular Queue\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue(capacity=7)\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n[]\n```\n\n\n#### You Can Visualize The Queue With All Details\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue(capacity=7, detail=True)\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### Enqueue\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue(capacity=7, detail=True)\nprint(x)\nx.enqueue(1)\nx.enqueue(2)\nx.enqueue(3)\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502 1 \u2502 2 \u2502 3 \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### Dequeue\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue([1, 2, 3], capacity=7, detail=True)\nprint(x)\nx.dequeue()\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502 1 \u2502 2 \u2502 3 \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502 2 \u2502 3 \u2502  \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### You Can Check If The Queue Is Empty Or Not\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue(capacity=7, detail=True)\nprint(x.isEmpty())\n```\n\n\n### Output\n\n\n```bash\nTrue\n```\n\n#### You Can Check If The Queue Is Full Or Not\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue([1, 2, 3, 4, 5, 6, 7], capacity=7, detail=True)\nprint(x.isFull())\n```\n\n\n### Output\n\n\n```bash\nTrue\n```\n\n\n#### You Can See The Item Who Can EXIT From The Queue Using peek Or top\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue([5, 6, 7], capacity=7, detail=True)\nprint(x.peek())\nprint(x.top())\n```\n\n\n### Output\n\n\n```bash\n5\n5\n```\n\n\n#### You Can See How Many Items Are In The Queue Using len Function\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue([5, 6, 7], capacity=7, detail=True)\nprint(len(x))\n```\n\n\n### Output\n\n\n```bash\n3\n```\n\n\n#### You Can Clear The Queue\n\n\n```python\nfrom cqueue import circularQueue\n\nx = circularQueue([5, 6, 7], capacity=7, detail=True)\nprint(x)\nx.clear()\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502 5 \u2502 6 \u2502 7 \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 <- EXIT \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502  \u2502 <- ENTER \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n### For Linked Circular Queue\n\n\nYou 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\n\n\n## License\n\n\nThis project is licensed under the MIT LICENSE - see the [LICENSE](https://opensource.org/licenses/MIT) for more details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Sophisticate Circular Queue",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://pypi.org/project/cqueue/"
    },
    "split_keywords": [
        "circular",
        "queue"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d81aa0f989b4a2407bcab10cb56861bcd068c933ebd211bada808452d80f1c4",
                "md5": "388262bea8db09529b517a8a8cead020",
                "sha256": "77e956e35e2574628acc5973b7dd7257f74c0869452165ed0eb6da2e2c76450b"
            },
            "downloads": -1,
            "filename": "cqueue-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "388262bea8db09529b517a8a8cead020",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5251,
            "upload_time": "2024-10-29T14:39:34",
            "upload_time_iso_8601": "2024-10-29T14:39:34.002228Z",
            "url": "https://files.pythonhosted.org/packages/1d/81/aa0f989b4a2407bcab10cb56861bcd068c933ebd211bada808452d80f1c4/cqueue-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "859da71ee234774b51c4a5b333b127993cfa24af14f050ee1d48db6727b2a09f",
                "md5": "d6db8abb082a402466310534aab7c713",
                "sha256": "eb6b6943feb508b7fc6535ba1065e1662193324152cca0e6d909421202cc03d0"
            },
            "downloads": -1,
            "filename": "cqueue-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d6db8abb082a402466310534aab7c713",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4613,
            "upload_time": "2024-10-29T14:39:35",
            "upload_time_iso_8601": "2024-10-29T14:39:35.566369Z",
            "url": "https://files.pythonhosted.org/packages/85/9d/a71ee234774b51c4a5b333b127993cfa24af14f050ee1d48db6727b2a09f/cqueue-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 14:39:35",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cqueue"
}
        
Elapsed time: 0.34236s