• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

insertion sort (1 Viewer)

aerialsprite

New Member
Joined
Oct 30, 2003
Messages
19
Does anyone know a good insertion sort algorithm? I can't seem to figure out the one in the textbook...
 

SamD

Member
Joined
Jul 21, 2002
Messages
256
Gender
Male
HSC
N/A
Here's my simple one:

Code:
BEGIN
  WHILE More items to insert
     Find where the current item should go
     Make a space for it
     Shove the item in the space
  ENDWHILE
END
If asked in the HSC, you'd get some marks for this but obviously a bit more detail would be needed.

Are you using my text? I suspect not. You can download Ch4 for free from www.pedc.com.au which has more detail on this stuff.

HTH
Sam
 
Last edited:

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

Top