On a single threaded architecture, I would use the quick sort:
http://en.wikipedia.org/wiki/Quick_sort
On a parallel architecture, I would use Parallel Sorting by Regular
Sampling:
https://agora.cs.illinois.edu/download/attachments/24348363/Sort+ParaProg(Quinn)chpt14.5.pdf
In the case of
Create your own malloc() free() functions. when you allocate
memory, allocate a little bit extra memory to add a token of your
choosing. When free'ing the memory, check that the token is still
there. You are going to want to add the token to the beginning of the
memory, and not at the end for
What about a quick sort O(log n)
void sort_stack(Stack *src, Stack *dst)
{
if(! src-IsEmpty() )
{
Stack smaller, larger;
int pivot = src-Pop();
while(! src-IsEmpty() )
{
int tmp = src-Pop();