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

QSORT会破坏序列原顺序吗?

Posted by OOOOOOOO at 2006-01-04 22:44:32 on Problem 1007
这是我的比较函数
int sort_func(const void *a,const void *b)
{
	return (((struct item *)a)->inversions - ((struct item *)b)->inversions)>0 ?1:-1;
}

数组中的inversions全部置0;
调用qsort之后,顺序竟然变了;

比如之前是
A C G T
排序之后是
C G A T

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