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(d)
[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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7ab67a7cb9d4e16ddaa4cd2d146ebda1ca13255f31d6c3cb3a80ebcb1705de5 |
|
MD5 | ca6620ed04fdd97f8f58e13df4a227b0 |
|
BLAKE2b-256 | 4249440b589f9a596dc06661b7d2468068b9db791620440f4c96bd0db29f8a2b |
Close
Hashes for doubly_py_linked_list-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e59f9290f332ea69db421d5fc57f15c5105d6f16c384733c95a1cb89c413f4a |
|
MD5 | 4395a0b22cb762431a6aef5def8fe323 |
|
BLAKE2b-256 | 3ef860680bbb0d48485715a243d3e87b1c7c0eb933ee5a84181afaf9a7fd2a01 |