Hi guys,
I got this from my teacher and im really confused. could anyone point me in the right direction?
Thanks
What does it do?
This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle:
"This function ..........., by ................ ."
This function takes a list of numbers as an argument, and returns a list of numbers.
To help you figure it out, cut out 5 or 6 pieces of paper, write some numbers on them, put them on a table, and run the algorithm yourself.
define MyFunction (list):
for OuterForLoopCounter in 1 to listlength-1:
for InnerForLoopCounter in 1 to listlength-1:
if list[InnerForLoopCounter] is greater than list[InnerForLoopCounter+1]:
swap list[item] and list[item+1]
return (list)