mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-28 08:33:36 +00:00
updated merge function
This commit is contained in:
parent
d96cc64ce7
commit
fdbea27d41
@ -331,12 +331,15 @@ class SortedLinkedList:
|
||||
"""
|
||||
if other_list.head is None:
|
||||
return
|
||||
if self.head is None:
|
||||
elif self.head is None:
|
||||
self.head = other_list.head
|
||||
self.tail = other_list.tail
|
||||
return
|
||||
self.tail.next_node = other_list.head
|
||||
self.tail = other_list.tail
|
||||
else:
|
||||
temp=otherother_list.head
|
||||
while temp:
|
||||
self.insert(temp.data)
|
||||
temp=temp.next_node
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
x
Reference in New Issue
Block a user