Skip to content

Commit 8feda3d

Browse files
committed
update
1 parent 1c9b6cd commit 8feda3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/Merge_Linked_List.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def mergeList(a, b):
77
#If the first node is null, or the second node exists and is smaller than the first node, swap the two nodes
88
#This ensures that a is always the smallest non null node
99
if not a or b and a.val > b.val: a, b = b, a
10-
#If a is not null, then let its next value be a recursive call to its next value, and b
10+
#If a is not null, then let its next value be a recursive call to its next value, and b (the smaller nodes next value will become the smaller of its current next value, or the other lists current value)
1111
if a: a.next = mergeList(a.next, b)
1212
#Return a's head as we never shifted a in this scope, only in subsequent recursive calls
1313
return a

0 commit comments

Comments
 (0)