mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-22 08:21:12 -04:00
.. | ||
detect_cycle.py | ||
double_linked_list.py | ||
linked_list_fifo.py | ||
linked_list_II.py | ||
merge_two_lists.py | ||
README.md | ||
reverse_linked_list.py | ||
swap_every_two_nodes.py |
Linked List
- unlike an array, a list does not provide constant time access to an index (as it needs to interact through all k elements), however addition and removal of elements are constant time.
- to remove a node you set
prev.next
equal tonode.next
. if it's a double list, you also updatenode.next
withnode.next.prev
tonode.prev
(and deallocate the memory).
LinkedListFIFO.py
python LinkedListFIFO.py
Linked List FIFO
Add 1: None
Add 2: Nonew
Add 3: None
Length: 3
Find 1: (None, None, 0)
Delete 1: None
Length: 0
Find 1: (None, None, 0)