2013年9月6日

摘要: qsort函数是ANSI C标准中提供的,其声明在stdlib.h文件中,是根据二分发写的,其时间复杂度为n*log(n),其结构为:void qsort(void *base,size_t nelem,size_t width,int (*Comp)(const void *,const void *));其中:*base为要排序的数组nelem为要排序的数组的长度width为数组元素的大小(一字节为单位)默认是从小到大排序的!(* Comp)(const void *p1,const void *p2)为判断大小函数的指针,这个函数需要自己定义,如果p1>p2,函数返回-1;ab , 阅读全文
posted @ 2013-09-06 13:08 昔日的青春 阅读(681) 评论(0) 推荐(0) 编辑

导航