🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Martin Tichy Mon, 16 Nov 1992 07:19
Shell Sort
#1095
Author: Martin Tichy
Date: Mon, 16 Nov 1992 07:19
14 lines
739 bytes
Can anyone please post or mail me a C++ shell sort?  I can't
seem to get this one to work.

void shell_sort (int list[], int size)
{
int i, j, gap;
 
for ( gap = size / 2; gap > 0; gap /= 2)
  for (i = gap; i < size; i++)
    for (j = i - gap; j >= 0; j -= gap)
      if (list [i] <= list [i+1]
        break;
swap ( &list [j], &list [j+1] );
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads