Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:在建平衡树前对数据排序,用sort可以,用qsort就TLE了.这是为什么啊?In Reply To:在建平衡树前对数据排序,用sort可以,用qsort就TLE了.这是为什么啊? Posted by:false at 2008-04-12 22:03:12 qsort对基本有序的输入性能很差,std::sort保证O(n lg(n)) > 我的qsort的cmp方法这么写的 > int cmp(const void * p1, const void * p2){ > return (*(int*)p1) - (*(int*)p2); > } > > qsort(a, u, sizeof(int), cmp); > > 有什么问题么?真奇怪啊 > 去看看STL原理去.... Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator