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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dd134dc0d4b772ccd5043721b8039ac191da98441da761d7598a775e052a4df |
|
MD5 | 1ba77a631b7d1390bc1d29bfd1d021d4 |
|
BLAKE2b-256 | c57af36b37e784e568c1dcab5078cfeffd3b2e1235fe8dd621015b60d6014953 |
Close
Hashes for doubly_py_linked_list-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9149c660846062b675bd290fc064bfb6c2fd5fc47d2236e2aaa2733ff3db2a4f |
|
MD5 | 9af03b0c803a56e1c14a470e5c54fb03 |
|
BLAKE2b-256 | 90b39284bdcfb8d18e4d3c59d68a335dedd0bcc8f58f017b8ab498659dbe6cb2 |