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

也谈冒泡

Posted by peterdi at 2008-12-12 22:18:06 on Problem 1455
将一个桌子分成两部分,对其中的一个进行冒泡排序,可以得到题中要求的逆序,但是该部分的首尾没有解决问题。对另一边进行冒泡排序,则可以同时把前一段的首尾同时解决.
如:       1   冒泡1    3    冒泡2    3
        2   5  ->   2   5   ->    2   4
         3 4         1 4           1 5
所以交换次数为两次冒泡之和,这个次数大家都知道就不说了。。注意奇偶。

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