On Apr 9, 2005, at 21:50, Kent Johnson wrote:
I think you have to return a value when len(t) <= 1. You don't return
anything which means you return None which can't be added to a list.
Kent
Yup. Here's a quicksort I did, adapting an example from the Wikipedia
article on Haskell:
def qsort(toSo
I think you have to return a value when len(t) <= 1. You don't return anything which means you
return None which can't be added to a list.
Kent
Logesh Pillay wrote:
I'm trying to program quicksort using list comprehension.
The following gives me a type mismatch error for "+".
def qsort (t):
i
I'm trying to program quicksort using list comprehension.
The following gives me a type mismatch error for "+".
def qsort (t):
if len (t) > 1:
return qsort([x for x in t[1:] if x <= t[0]]) + [t[0]] + qsort([x
for x in t[1:] if x > t[0]])
I know this sounds strange but I have and idea