Home > Back-end >  Tree quick sort
Tree quick sort

Time:06-04

C language library functions which have a built-in realization of quick sort function, it can greatly save time not to write quick sort,
# include
# include//tree function header file
Int comp (const void * a, const void * b)
{
Return * (int *) a - b * (int *);//ascending order
//return - * * (int *) b (int *) a; Descending order
}
Void main ()
{
,3,5,1,44,55,64,32,7,6 int a [10]={2};
int i;
Tree (a, 10, sizeof (int), comp);//call a function, a first address as an array, and ten for sorting number, sizeof sort the number of bytes read, comp for sorting standard
for(i=0; i<10; I++)
{
Printf (" % d ", a [I]);
If (i<9)
Printf (" & lt; ");
}
}

CodePudding user response:

I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related