Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2010-02-08 04:52:44

d1hater
Guest

Argh I Hate Decision Mathematics!

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.... swearswearswearswearswearswearswearswearswearswearswearswearswearswear

#2 2010-02-08 05:10:30

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Argh I Hate Decision Mathematics!

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

#3 2010-02-08 05:14:25

d1hater
Guest

Re: Argh I Hate Decision Mathematics!

ok, but the answer say you got to have 9 steps

im so confused........

#4 2010-02-08 05:30:39

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Argh I Hate Decision Mathematics!

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

#5 2010-02-08 05:40:36

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Argh I Hate Decision Mathematics!

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

Board footer

Powered by FluxBB