Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:在建平衡树前对数据排序,用sort可以,用qsort就TLE了.这是为什么啊?

Posted by slashdot at 2011-04-07 23:50:57 on Problem 1442
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator