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

用quick sort老是TLE, 见过各位讨论, 改用heap sort, AC 了: 2096K 765MS

Posted by Lucas at 2005-03-13 00:02:46 on Problem 1002
quick sort:
  平均情况:
      比较次数:  1.39 n lg n + O(n)
      交换次数:  0.69 n lg n + O(n)
  最坏情况:
      O(n^2) 出现灾难!!!

heap sort:
  最坏情况:
      比较次数:  比quick sort的平均情况稍差一点
      交换次数:  比quick sort的平均情况稍好一点

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