• 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

what type of algorithms are we expected to write up (1 Viewer)

m00

Member
Joined
Oct 6, 2007
Messages
113
Gender
Male
HSC
2008
is it common for them to ask us to write up insertion sorts and selection sorts?
 

BoyNextDoor

Member
Joined
Dec 12, 2007
Messages
430
Gender
Male
HSC
2008
^
I've done some past paper questions in class and they've asked us to write out an algorithm that would sort the data in a certain way.
 

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
Yeah, you should know how to do bubble, insertion and selection sorts, as well as their pros and cons.
Also you should know how to do a linear and binary search, as well as when they can/should be used.
 

JDurrant

Member
Joined
Aug 4, 2006
Messages
73
Gender
Male
HSC
2008
From the papers I've done they're more likely to ask you to identify it (in pseudocode) rather than write it yourself
 

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
JDurrant said:
From the papers I've done they're more likely to ask you to identify it (in pseudocode) rather than write it yourself
I have done a trial in which you had to write a bubble sort and a binary selection.
 

JDurrant

Member
Joined
Aug 4, 2006
Messages
73
Gender
Male
HSC
2008
I wish we had some database of algorithm questions, hardest topic i think. Everything else is either common sense or rote learning.

anyone?
 

Rampager

Member
Joined
Jun 4, 2008
Messages
100
Gender
Male
HSC
2008
Graceofgod said:
I have done a trial in which you had to write a bubble sort and a binary selection.
Sorry, binary selection? Either you have no idea what you just stated, or you meant "binary search", binary selection is an "If" statement.

You need to know the basic algorithm behind the sorts,

Bubble works by comparing the value of the current index to (current index + 1) and swaps them if array[currentindex] is bigger.

Selection finds the highest(or lowest) and performs the swap function again.

Insertion works through the array and places the value at the expected location in the array.

Only insertion needs an example, [2,7,4,3,5,1]
> 2 is considered sorted
> First pass: 7 is in its correct position
> Second: 4 should be inbetween 2 and 7.
> Third: 3 should be inbetween 2 and 4
etc.
First pass: [2,7,4,3,5,1]
Second pass: [2,4,7,3,5,1]
Third pass: [2,3,4,7,5,1]
Fourth pass: [2,3,4,5,7,1]
Fifth pass: [1,2,3,4,5,7]


Once you know the basic algorithm, writing it in pseudocode is hilariously easy, remember you can take massive shortcuts using pseudocode, where statements like "Shift array from Array1] up one spot." "Array[1] = UnsortedNumber" are considered accurate.
 
Last edited:

Graceofgod

Member
Joined
Feb 17, 2008
Messages
136
Location
Now? A computer.
Gender
Undisclosed
HSC
2008
Rampager said:
Sorry, binary selection? Either you have no idea what you just stated, or you meant "binary search", binary selection is an "If" statement.
Yes I did mean binary search. My mistake, little tired yesterday.

EDIT: However, i have done a trial or two with a binary selection!! =D
 

Rampager

Member
Joined
Jun 4, 2008
Messages
100
Gender
Male
HSC
2008
Graceofgod said:
Yes I did mean binary search. My mistake, little tired yesterday.

EDIT: However, i have done a trial or two with a binary selection!! =D
lol I would hope so :D Gotta love tossing in a binary selection. ;)
 

m00

Member
Joined
Oct 6, 2007
Messages
113
Gender
Male
HSC
2008
can somone give me short and easy to remember example of an insertion sort and a selection sort i find the algorithm's in the book very hard to remember
 

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

Top