English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

1 2 7 0 3
2 4 1 2 1
8 4 6 2 5

the answer should be
2 4 1 2 1
1 2 7 0 3
8 4 6 2 5

2006-07-07 19:56:42 · 2 answers · asked by Kunal N 2 in Computers & Internet Programming & Design

2 answers

You didn't say what language? In C or C++, you can use the standard library function quicksort(). You just need to create a custom sorting function that takes an entire row of the array and simply compares the last column.

2006-07-07 21:18:11 · answer #1 · answered by Flyboy 6 · 0 0

This would vary greatly depending on the computer language involved. Not sure where the 2d array comes in -- you provided 3 integers. Speaking generally, if you use modulus on those numbers, you can pick off the last digit using Mod 10. So assuming for example that the modulus operator is '%', then:

12703 % 10 = 3.

If your program created an array that was keyed by the number % 10, and then you sorted on that key, you'd have the solution.

2006-07-08 03:59:31 · answer #2 · answered by Gizmo L 4 · 0 0

fedest.com, questions and answers