void my_sort(long left, long right)
{
struct KEY_INFO w_key;
long w_last;
long w_cnt;
if ( left < right ) {
w_key = g_key[left];
g_key[left] = g_key[(left+right)/2L];
g_key[(left+right)/2L] = w_key;
w_last = left;
for ( w_cnt = left + 1L; w_cnt <= right; w_cnt++ ) {
if (memcmp(g_key[w_cnt].key, g_key[left].key,
sizeof(g_key[0].key)) < 0L ) {
w_key = g_key[++w_last];
g_key[w_last] = g_key[w_cnt];
g_key[w_cnt] = w_key;
}
}
w_key = g_key[left];
g_key[left] = g_key[w_last];
g_key[w_last] = w_key;
quick_sort( left, w_last-1L );
quick_sort( w_last+1, right );
}
}
mySort
投稿者 weijingli 時刻: 12/02/2007
ラベル: C++
Subscribe to:
Post Comments (Atom)
0 コメント:
Post a Comment