recursive functions of a class

I am trying to write a recursive sorting member function of a template class, but once it executes the the function call it crashes. Please Help!!

template <typename T>
bool sClass<T>:: insertionSort()
{
bool done = false;
T holder;
int flag = 0;

while ( done == false && numValues > 1)
{
if ( insertSort < elements[numValues-2])
{
flag = 0;
for ( int i =0; i < numValues; i++)
{
for (int x =1; x < numValues; x++)
{
if ( elements[i] > elements[x])
{
holder = elements[i];
elements[i] = elements[x];
elements[x] = holder;
flag ++;
insertionSort();
}
}
}
}
if ( flag == 0)
done = true;
else
insertionSort ();

}
return done;
}
Last edited on
Why does your insertion sort need to be recursive?
Topic archived. No new replies allowed.