Can someone help
me to write a code that with sort through a list of strings which are peoples names
without using the python sort function.
So the rules are :
We start with an initial pile containing only the first name in the list.
Go through all the other names in the list from left to right and place each name on top of the left most
pile for which it is less than the name on top of this pile. If there is no such pile, we create a new pile
containing this name to the right of the other piles.
Until all the piles are empty, we repeatedly select and remove the smallest name among all those on top
of the pile.
The code I have so far is :
M = [L]
for i in L[1:]:
J = [M]
if J > i:
M = M +[i]
create a new pile
M = [i] + M
I was wondering how would I create new lists , since I do not know in the beginning how many piles/lists
will be needed.
Thanks ;) Rouby + Mona
Ps= CS is killing us any help would be appreciated :'(