Did anyone write the 6mark algorithm?? (1 Viewer)

ZzJasonzZ

Member
Joined
Mar 25, 2004
Messages
36
Location
Sydney
Wild Dan Hibiki said:
dammit i forgot to chuck in seat >1 < 11
don't beat yourself up about it.. the question was worth 6 marks chances are you wont do everything perfect if you didnt validate it (between 1 and 10) you might lose half a mark and another half for something else.. but if you did validate it and didnt do something else you will still get 5 /6
 

acmilan

I'll stab ya
Joined
May 24, 2004
Messages
3,989
Location
Jumanji
Gender
Male
HSC
N/A
What problems did you guys find for their algorithms, i found 3:

1. It printed only after it exited the loop, meaning it only printed the last row,seat that it checked.
2. It printed array(row,seat) which didnt give the seat and row number but rather whether it was unsold or sold.
3. Once seat = 11, it exited the inner loop and doesnt reenter the inner loop becuase seat is never set back to 1 so remains at 11 all the time so it only checks the first row
 

scorpi0n

New Member
Joined
Oct 28, 2004
Messages
19
Gender
Male
HSC
2004
okie dokie i'm pretty sure this is how i did it, maybe a bit different but here goes.

BEGIN print_adjacent_seats
seat = 1
row = 1
available = false
amount_available = 0
WHILE row <=8
WHILE seat <=10
IF array(row,seat) = "unsold" THEN
available = true
amount_available = amount_available + 1
ELSE available = false
ENDIF
IF available = true AND amount_available = 2 THEN
print array(row, seat)
print array((row-1), (seat-1)
ELSEIF available = true AND amount_available > 2 THEN
print array(row,seat)
ENDIF
increment seat
available = false
ENDWHILE
increment row
ENDWHILE
END print_adjacent_seats

i think thats right. although thinking about it now, i may have forgotten the increment row lol...hopefully i wont be penalised much considering thats given in the question and i worked out the hard bit...
 

Wild Dan Hibiki

teh sex0r
Joined
Feb 28, 2004
Messages
649
Gender
Undisclosed
HSC
2004
acmilan said:
What problems did you guys find for their algorithms, i found 3:

1. It printed only after it exited the loop, meaning it only printed the last row,seat that it checked.
2. It printed array(row,seat) which didnt give the seat and row number but rather whether it was unsold or sold.
3. Once seat = 11, it exited the inner loop and doesnt reenter the inner loop becuase seat is never set back to 1 so remains at 11 all the time so it only checks the first row
yeah i wrote down 1 and 3. we only needed two errors right?
 

Archman

Member
Joined
Jul 29, 2003
Messages
337
Gender
Undisclosed
HSC
N/A
one problem;
print array(row, seat) doesnt do jack. cuz the value of array(row, seat) is either "sold" or "unsold"

so u'll be printing loads of "sold"s and "unsold"s, but not the actual seats.
 

acmilan

I'll stab ya
Joined
May 24, 2004
Messages
3,989
Location
Jumanji
Gender
Male
HSC
N/A
Yeh but i just happened to find another one. And scorpion unfortunately you made the error in 2 by printing array(row,seat) which would print out "unsold" instead of the actual row and seat.
 

scorpi0n

New Member
Joined
Oct 28, 2004
Messages
19
Gender
Male
HSC
2004
acmilan said:
Yeh but i just happened to find another one. And scorpion unfortunately you made the error in 2 by printing array(row,seat) which would print out "unsold" instead of the actual row and seat.
lol damn, now did i do that in the exam? i think so. oh well, i'll be happy with anything over 3/6 for that...
 

MedNez

:o>---<
Joined
Aug 21, 2004
Messages
3,004
Gender
Male
HSC
N/A
oh noes ..

the algorithm i kind of made up :p

It was something along the lines of looking at the seats you bought, and giving you a list of those either side that were unsold. In a makeshift way. Kind of.
 

xeriphic

Member
Joined
May 7, 2004
Messages
452
Location
Sydney
PoP 'n' Fresh said:
that algorithm was easy!
it was basically copying their code, fixing the logic error, then for the if statement was:
IF array(row,seat) = "unsold" AND array(row,seat +1) = "unsold"
print array(row,seat), array(row,seat + 1)
End if

note: u had to change the while condition to <= 9, otherwise it would be an error trying to access out of bouns
kahahahahahahaha that's what I did
 
Joined
Feb 28, 2004
Messages
131
Location
sdfsdf
Gender
Male
HSC
2002
I did it, but I also considered that the seat before it may be empty......lol.......stupid me.........
 

PoP 'n' Fresh

Poke me! I giggle!
Joined
Aug 23, 2004
Messages
193
Location
Manly
Gender
Male
HSC
2005
yeh the way i did it works in theory... really it does, desk check it =p
the only band thing tho is that if there are lets say 3 seats together, the second seat will be printed twice =p
hehe 4/5 is good enough
 

token girl

Member
Joined
Nov 25, 2003
Messages
40
Location
How specific do you want? Earth do? :-p
Gender
Female
HSC
2004
acmilan said:
What problems did you guys find for their algorithms, i found 3:

1. It printed only after it exited the loop, meaning it only printed the last row,seat that it checked.
2. It printed array(row,seat) which didnt give the seat and row number but rather whether it was unsold or sold.
3. Once seat = 11, it exited the inner loop and doesnt reenter the inner loop becuase seat is never set back to 1 so remains at 11 all the time so it only checks the first row
I wrote 1 and 3 as well. My algorithm was....interesting. I knew it didn't really work but I had the basics and was spending too much time on it anyway, so I moved on. It worked on the same basics principle as theirs, which is what most people have said.
 

Doogsy

Member
Joined
Feb 1, 2004
Messages
76
i think even if your algorithm didnt even relate to the question, you still get marks for indenting, correct use of key words with capitals etc. (likewise, you lose marks for not using these things)
 

screw_uni

New Member
Joined
Aug 19, 2004
Messages
9
I wrote something that looked something like an algorithm :p nahh i did alright with it I think.. u get marks just for having BEGIN and END in the right place so yeh I wrote about a page for this Question.. hopefully i got bout 4 marks for it..!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top