cqueue


Namecqueue JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://pypi.org/project/cqueue/
SummarySophisticate Circular Queue
upload_time2024-06-16 23:40:11
maintainerNone
docs_urlNone
authorkhiat Mohammed Abderrezzak
requires_python>=3.6
licenseMIT
keywords 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": "queue",
    "author": "khiat Mohammed Abderrezzak",
    "author_email": "khiat.abderrezzak@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2e/01/2844a6da0511a46c8b541a7daf77da9dd616c810564a6cadd607f5943fe2/cqueue-1.0.5.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.0.5",
    "project_urls": {
        "Homepage": "https://pypi.org/project/cqueue/"
    },
    "split_keywords": [
        "queue"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7fb44e98f0a9a43f04674376f07bac73c44f05ed8c261985487c2b33fbf88fb8",
                "md5": "7b0fb15ee6aa80a9ca13b7e49b344444",
                "sha256": "209d5784b9a8b92618053fc682691b550a44232c56e78489c7fab1b640a7f46e"
            },
            "downloads": -1,
            "filename": "cqueue-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7b0fb15ee6aa80a9ca13b7e49b344444",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4495,
            "upload_time": "2024-06-16T23:40:09",
            "upload_time_iso_8601": "2024-06-16T23:40:09.771150Z",
            "url": "https://files.pythonhosted.org/packages/7f/b4/4e98f0a9a43f04674376f07bac73c44f05ed8c261985487c2b33fbf88fb8/cqueue-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2e012844a6da0511a46c8b541a7daf77da9dd616c810564a6cadd607f5943fe2",
                "md5": "7ee4b337d5c9cc6d222122fcec4538ad",
                "sha256": "3a5eb857c04d1e3f9816a0faebf624761c4ac800cff33de1b3a110a8d3d78179"
            },
            "downloads": -1,
            "filename": "cqueue-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "7ee4b337d5c9cc6d222122fcec4538ad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4514,
            "upload_time": "2024-06-16T23:40:11",
            "upload_time_iso_8601": "2024-06-16T23:40:11.736174Z",
            "url": "https://files.pythonhosted.org/packages/2e/01/2844a6da0511a46c8b541a7daf77da9dd616c810564a6cadd607f5943fe2/cqueue-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-16 23:40:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "cqueue"
}
        
Elapsed time: 0.26642s