• 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

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