Skip to content

Latest commit

 

History

History
28 lines (16 loc) · 570 Bytes

README.md

File metadata and controls

28 lines (16 loc) · 570 Bytes

Doubly LinkedList implementation

Doubly LinkedList diagram

from LinkedList import LinkedList


linkedlist = LinkedList()
start_data = [1, 2, 3, 4, 5]
end_data = [6, 7, 8, 9, 10]

for i in start_data[::-1]:
    linkedlist.prepend(i)

for i in end_data:
    linkedlist.append(i)

print(linkedlist)

>>> <LinkedList([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])>

! First, create head nodes using the prepend method..

inspired by M2skills