Tuesday, September 30, 2008

Shell Sort

#ifndef SHELLSORT
#define SHELLSORT

namespace mystd
{
void ComputeStep(int *step, int size)
{
if (size < step =" size" step =" size"> 100 && size < step =" size" t="">
void ShellSort(T* sortee, int size)
{
int step = 0;
ComputeStep(&step, size);

while(step > 0)
{
for(int loop=0;loop=step
&& *(sortee + index - step) > value)
{
*(sortee + index) = *(sortee + index - step);
index = index - step;
}
*(sortee + index) = value;
}
--step;
}
}
}











#endif

No comments: