You are not logged in.
Pages: 1
seriously, what the hell?!
i've been doing something called "Shuttle-Sort Algorithm" which is pretty each right?
well, yea, it should be. but why do I NOT GET THE MARKS?!
look at this example:
"Use shuttle-sort algorithm to sort these numbers in ascending order. Show full working:
76 81 59 65 71"
my working:
-> 76 59 81 65 71
-> 59 76 81 65 71
-> 59 76 65 81 71
-> 59 65 76 81 71
-> 59 65 76 71 81
-> 59 65 71 76 81
so why is this wrong BLARGH....
The problem with your way, is that you don't finish going from left to
right when you make a swap.
First it goes left to right and the biggest one ends up on the right.
Then it goes right to left and the smallest one ends up on the left.
But you cut it off short after the swap.
Here's how it goes:
76 81 59 65 71
76 59 81 65 71
76 59 65 81 71
76 59 65 71 81
That was the right stuff above,
now go left from the right side.
59 76 65 71 81
Okay now go right from the left side.
59 65 76 71 81
59 65 71 76 81
Now you are done.
igloo myrtilles fourmis
Offline
ok, but the answer say you got to have 9 steps
im so confused........
Let me try another one instead to warm up...
start with:
CATFOOD
go right from left side:
ACtfood
aCTfood
acFTood
acfOTod
acfoOTd
acfooDT
Notice I'm showing every single step now.
The capital letters were the 2 being compared or considered.
Now start on the right and go left:
acfooDT
acfoDOt
acfDOot
acDFoot
aCDfoot
ACdfoot
Now go from left to right again:
ACdfoot
aCDfoot
acDFoot
acdFOot
acdfOOt
acdfoOT
No swaps were made that pass so we are done!!!
igloo myrtilles fourmis
Offline
76=D 81=E 59=A 65=B 71=C
go right from left-side...
D E - - -
- A E - -
- - B E -
- - - C E
go left from right-side...
- - - C E
- - B C -
- A B - -
A D - - -
go right from left-side...
- B D - -
- - C D -
All done!
igloo myrtilles fourmis
Offline
Pages: 1