SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def merge(lists, field):
  2.     new_lst = merge_lists(lists)
  3.    
  4.     def qs(lst,field):
  5.         if len(lst) <= 1:
  6.             return lst
  7.         else:
  8.             pivot = lst[0]
  9.             smaller = []
  10.             equal = []
  11.             larger = []
  12.             for i in range(0,len(lst)):
  13.                 if field(lst[i]) < field(pivot):
  14.                     smaller.append(lst[i])
  15.                 if field(lst[i]) > field(pivot):
  16.                     larger.append(lst[i])
  17.                 if field(lst[i]) == field(pivot):
  18.                     equal.append(lst[i])
  19.             return qs(smaller,field) + equal + qs(larger,field)
  20.            
  21.     return qs(new_lst,field)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top