Article View: comp.std.c++
Article #1095Shell Sort
From: Martin Tichy
Date: Mon, 16 Nov 1992 07:19
Date: Mon, 16 Nov 1992 07:19
14 lines
739 bytes
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] );
}
Technical Details
Message-ID:
<1992Nov16.071937.12110@sfu.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!newsserver.sfu.ca!mtichyShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!newsserver.sfu.ca!mtichy From: mtichy@fraser.sfu.ca (Martin Tichy) Subject: Shell Sort Message-ID: <1992Nov16.071937.12110@sfu.ca> Sender: news@sfu.ca Organization: Simon Fraser University, Burnaby, B.C., Canada Date: Mon, 16 Nov 1992 07:19:37 GMT Lines: 15