master-algorithms-py/linked_lists
2023-07-31 12:21:30 -07:00
..
double_linked_list.py Rename linked_list-double.py to double_linked_list.py 2023-07-31 12:00:43 -07:00
linked_list_fifo.py Rename LinkedListFIFO.py to linked_list_fifo.py 2023-07-31 11:59:00 -07:00
README.md Update README.md 2023-07-29 20:34:26 -07:00
reverse_linked_list.py Create reverse_linked_list.py 2023-07-31 12:21:30 -07:00
swap_every_two_nodes.py Create swap_every_two_nodes.py 2023-07-31 12:00:18 -07:00

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 to node.next. if it's a double list, you also update node.next with node.next.prev to node.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)