Thread: Sorting Help
View Single Post
Old 10-16-2005, 06:15 AM   #6 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
Pseudocode
Code:
if(!(array_size%4)) /* ensure we can shift 4 items on each run */
  store array[array_size -3] in temp_1
  store array[array_size -2] in temp_2
  store array[array_size -1] in temp_3
  store array[array_size] in temp_4
  while(array[index])
    switch array[index] with temp_1
    switch array[index+1] with temp_2
    switch array[index+2] with temp_3
    switch array[index+3] with temp_4
    index+=4
And you couldn't think of that yourself ?

By the way, what is old C++ ?? you've got the STL right there, why not use it??
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote