Advertisement
STANAANDREY

lsd intercl rec

Oct 22nd, 2022 (edited)
663
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def merge(lst1, lst2):
  2.     if len(lst1) == 0:
  3.         return lst2
  4.     if len(lst2) == 0:
  5.         return lst1
  6.  
  7.     if lst1[0] > lst2[0]:
  8.         return [lst2[0]] + merge(lst1, lst2[1:])
  9.     else:
  10.         return [lst1[0]] + merge(lst1[1:], lst2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement