lstack


Namelstack JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/lstack/
SummarySophisticate Linked Stack
upload_time2024-10-29 14:42:11
maintainerNone
docs_urlNone
authorkhiat Mohammed Abderrezzak
requires_python>=3.6
licenseMIT
keywords linked stack
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lstack


[![PyPI version](https://badge.fury.io/py/lstack.svg)](https://badge.fury.io/py/lstack)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)


This library was created to make the stack concept easier to understand by visualizing it and showing how objects enter and exit the stack, especially for beginners in data structures 


## Installation


You can install `lstack` via pip:


```bash
pip install lstack
```


## Usage 


### For singlyLinkedStack


```python
from lstack import singlyLinkedStack

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


### Output


```bash
[]
```


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


```python
from lstack import singlyLinkedStack

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


### Output


```bash
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
╘════════════╛
```


#### Push


```python
from lstack import singlyLinkedStack

x = singlyLinkedStack(capacity=7, detail=True)
print(x)
x.push(1)
x.push(2)
x.push(3)
print(x)
```


### Output


```bash
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
╘════════════╛
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
│ 3          │
├────────────┤
│ 2          │
├────────────┤
│ 1          │
╘════════════╛
```


#### Pop


```python
from lstack import singlyLinkedStack

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


### Output


```bash
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
│ 3          │
├────────────┤
│ 2          │
├────────────┤
│ 1          │
╘════════════╛
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
│ 2          │
├────────────┤
│ 1          │
╘════════════╛
```


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


```python
from lstack import singlyLinkedStack

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


### Output


```bash
True
```

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


```python
from lstack import singlyLinkedStack

x = singlyLinkedStack([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 Stack Using peek Or top


```python
from lstack import singlyLinkedStack

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


### Output


```bash
7
7
```


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


```python
from lstack import singlyLinkedStack

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


### Output


```bash
3
```


#### You Can Clear The Stack


```python
from lstack import singlyLinkedStack

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


### Output


```bash
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
│ 7          │
├────────────┤
│ 6          │
├────────────┤
│ 5          │
╘════════════╛
╒════════════╕
│ ENTER  ^   │
│   |    |   │
│   v   EXIT │
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
├────────────┤
╘════════════╛
```


### Note


You can use doublyLinkedStack with the same syntax as singlyLinkedStack with all previous methods the main difference is singlyLinkedStack use static non circular singly linked list and doublyLinkedStack use static non circular doubly 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/lstack/",
    "name": "lstack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "linked stack",
    "author": "khiat Mohammed Abderrezzak",
    "author_email": "khiat.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f9/77/294683c6d8ec94cf23a893f92f8f6c06e99757919761c999cb00e826e24f/lstack-1.1.1.tar.gz",
    "platform": null,
    "description": "# lstack\n\n\n[![PyPI version](https://badge.fury.io/py/lstack.svg)](https://badge.fury.io/py/lstack)\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 stack concept easier to understand by visualizing it and showing how objects enter and exit the stack, especially for beginners in data structures \n\n\n## Installation\n\n\nYou can install `lstack` via pip:\n\n\n```bash\npip install lstack\n```\n\n\n## Usage \n\n\n### For singlyLinkedStack\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack(capacity=7)\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n[]\n```\n\n\n#### You Can Visualize The Stack With All Details\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack(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\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### Push\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack(capacity=7, detail=True)\nprint(x)\nx.push(1)\nx.push(2)\nx.push(3)\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 3          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 1          \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### Pop\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack([1, 2, 3], capacity=7, detail=True)\nprint(x)\nx.pop()\nprint(x)\n```\n\n\n### Output\n\n\n```bash\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 3          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 1          \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 2          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 1          \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n#### You Can Check If The Stack Is Empty Or Not\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack(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 Stack Is Full Or Not\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack([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 Stack Using peek Or top\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack([5, 6, 7], capacity=7, detail=True)\nprint(x.peek())\nprint(x.top())\n```\n\n\n### Output\n\n\n```bash\n7\n7\n```\n\n\n#### You Can See How Many Items Are In The Stack Using len Function\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack([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 Stack\n\n\n```python\nfrom lstack import singlyLinkedStack\n\nx = singlyLinkedStack([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\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 7          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 6          \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 5          \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 ENTER  ^   \u2502\n\u2502   |    |   \u2502\n\u2502   v   EXIT \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n```\n\n\n### Note\n\n\nYou can use doublyLinkedStack with the same syntax as singlyLinkedStack with all previous methods the main difference is singlyLinkedStack use static non circular singly linked list and doublyLinkedStack use static non circular doubly 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 Linked Stack",
    "version": "1.1.1",
    "project_urls": {
        "Homepage": "https://pypi.org/project/lstack/"
    },
    "split_keywords": [
        "linked",
        "stack"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08c3d675b5af839eed32062bdcb96096d818f686710e94d99778c9eed26f4722",
                "md5": "9a3c764278f44dd6e1ef7efe849e5080",
                "sha256": "4df139b6230c2a3427e83836244af9c19213c10f1dafa93954c36516cf421de9"
            },
            "downloads": -1,
            "filename": "lstack-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9a3c764278f44dd6e1ef7efe849e5080",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5243,
            "upload_time": "2024-10-29T14:42:09",
            "upload_time_iso_8601": "2024-10-29T14:42:09.889656Z",
            "url": "https://files.pythonhosted.org/packages/08/c3/d675b5af839eed32062bdcb96096d818f686710e94d99778c9eed26f4722/lstack-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f977294683c6d8ec94cf23a893f92f8f6c06e99757919761c999cb00e826e24f",
                "md5": "5b9f3f531cb09fb49ea25ae3c133ec54",
                "sha256": "f7b98a9d603880f5349b6cece78fdf6367a024e44274f24329dfdb3724332663"
            },
            "downloads": -1,
            "filename": "lstack-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5b9f3f531cb09fb49ea25ae3c133ec54",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4592,
            "upload_time": "2024-10-29T14:42:11",
            "upload_time_iso_8601": "2024-10-29T14:42:11.636122Z",
            "url": "https://files.pythonhosted.org/packages/f9/77/294683c6d8ec94cf23a893f92f8f6c06e99757919761c999cb00e826e24f/lstack-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 14:42:11",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lstack"
}
        
Elapsed time: 0.35944s