![]() |
sorting codes
can you pls help me find a way to sort two dimensional arrays with a size of [5][2] integer...i want to sort it from highest to lowest... can you pls help me with the codes...i only know how to sort 1 dimensional array using bubble sort...
Code:
printf("\nThe numbers from highest to lowest are: "); |
Re: sorting codes
It looks like you have not told us your exact requirements and in the context of your problem the best solution could be to convert the 2 dimensional array into a one dimension array of 5X2 elements and then sort it.
|
Re: sorting codes
You can actually just run through the 2D array and make your comparisons and swap when necessary. For instance, you may compare Array [3][1] with Array [4][6] and decide whether to swap them or not. This approach merely requires a loop for each dimension. For example,
Code:
for (i = 0; i < rowMax; i++) |
Re: sorting codes
Code:
#include<stdio.h> |
Re: sorting codes
Code:
#include<stdio.h> |
| All times are GMT +5.5. The time now is 10:44. |