0

exam TStu TExam
1 91 25
2 168 20
3 2080 46
4 680 56
5 15 12
6 680 22
7 166 20

How to sort in descending order like this..

4 680 56
3 2080 46
1 91 25
....................................

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

Hey Sorting is a huge topic and there are several ways of sorting the data.
which technique you want to use to sort this data.
Radix sort can do a job.
lets understand what you want

1 91 25
2 168 20
3 2080 46
4 680 56
5 15 12
6 680 22
7 166 20

you want to start sorting the data from the last two digits.
Algorithm goes like this.
read the list of numbers in arrays.
use suitable sorting algorithm.
the tricky part is how you would get the last two numbers to do comparision (if you are using comparision sorting technique). ? (its simple dear, try gettting the
(number % 100). it will give you last two digits. :).
Perform sorting.


Hope this help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.