involves making copies of the list this means that its space complexity is (len( )this can be an issue for large lists exploiting functions as parameters suppose we want to sort list of names written as firstname lastnamee the list ['chris terman''tom brady''eric grimson''gisele bundchen'figure defines two ordering functionsand then uses these to sort list in two different ways each function imports the standard python module stringand uses the split function from that module the two arguments to split are strings the second argument specifies separator ( blank space in the code in figure that is used to split the first argument into sequence of substrings the second argument is optional if that argument is omitted the first string is split using arbitrary strings of whitespace characters (spacetabnewlinereturnand formfeeddef lastnamefirstname(name name )import string name string split(name 'name string split(name 'if name [ !name [ ]return name [ name [ else#last names the samesort by first name return name [ name [ def firstnamelastname(name name )import string name string split(name 'name string split(name 'if name [ !name [ ]return name [ name [ else#first names the samesort by last name return name [ name [ ['chris terman''tom brady''eric grimson''gisele bundchen'newl mergesort(llastnamefirstnameprint 'sorted by last name ='newl newl mergesort(lfirstnamelastnameprint 'sorted by first name ='newl figure sorting list of names quicksortinvented by hoare in is conceptually similar to merge sortbut considerably more complex it has the advantage of needing only log(nadditional space unlike merge sortits running time depends upon the way the elements in the list to be sorted are ordered relative to each other though its worst-case running time is ( )its expected running time is only ( *log( )