[code]
template
void InsertionSort(T *sortee, int & size)
{
for (int loop=1;loop < size ; ++loop)
{
int index = loop;
T value = *(sortee + loop);
while(index > 0
&&
*(sortee + index - 1) > value)
// If left > right
{
// Left assign to right
*(sortee + index) = *(sortee + index - 1);
--index;
}
*(sortee + index) = value;
}
}
[/code]
No comments:
Post a Comment