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 |
你的意思是不是说如果数组里面有多个元素值相同的时候qsort会不会改变他们的顺序?In Reply To:QSORT会破坏序列原顺序吗? Posted by:OOOOOOOO at 2006-01-04 22:44:32 > 这是我的比较函数 > 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator