Doubly linked list implementation in Python
Project description
Doubly (Py) Linked List 1️⃣ ↔️ 2️⃣ ↔️ 3️⃣
A module that implements doubly linked lists in python
Example
python -m pip install doubly-py-linked-list
>>> from doubly_py_linked_list import DoublyLinkedList as dll
>>> d = dll([1, 2, 3, 4])
>>> d
1 <-> 2 <-> 3 <-> 4
>>> node_0 = d.insert_head(0)
>>> node_5 = d.insert_tail(5)
>>> for v in d:
... print(v)
...
0
1
2
3
4
5
>>> d.move_to_head(node_5)
>>> d.move_to_tail(node_0)
>>> list(d)
[5, 1, 2, 3, 4, 0]
>>> d.pop_head()
5
>>> list(d)
[1, 2, 3, 4, 5, 0]
>>> d.pop_tail()
0
>>> list(d)
[1, 2, 3, 4]
>>> d.nodes()
[ddl_node(1), ddl_node(2), ddl_node(3), ddl_node(4)]
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
Built Distribution
Close
Hashes for doubly_py_linked_list-1.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8247ec6e2a453ff37add8096e8522f1c5f983df77b0e011bb59f62a89f6c5cf |
|
MD5 | 59f36f207758d47808b3c1c8618a06e0 |
|
BLAKE2b-256 | ff361d6e00bbf5a62febad9268d7a5658531d7c63fd686e83018d2e097c65780 |
Close
Hashes for doubly_py_linked_list-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9b17bd1a1407e88d55bd980fc4cada076362554e7c8fad4c2259ced12500d64 |
|
MD5 | 9fd402d21ca8b38e4381f58b731cc9ae |
|
BLAKE2b-256 | ccb023f4edabfba4099770a53534b44dcdc69914dd74c7e900ec12aefe6bbb30 |