|
|
back to boarddoes only by M ? I made solution using stack to store ID data so after sorting by M all ID rows keep sorted in reverse way they meet in input and I got WA1 than I replace stack to queue by replacing "stack" to "queue" and ".top()" to ".front()" only and I got WA2 actually I find nothing in statement about order of ID rows with equal M Re: does only by M ? Posted by djosacv 21 Dec 2008 23:19 the order of id rows with same M is implicit in the statement when is said that your sorting algorithm must generate the same ordering that bubblesort generates. Bubblesort is a stable sorting algorithm (it doesn't change the order of records with same keys). So you should use a fast stable sorting algorithm (by the way the usual implementations of quicksort and heapsort aren't stable). Binary-tree and mergesort are stable. Insertion sort also. |
|
|