Re: simplest way to sort a bi-dimensional array? mat(a,b)...
- From: "Les" <l.neilson@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Jul 2007 17:10:18 +0100
"ginko" <ginko@xxxxxxxxxxx> wrote in message
news:mn.d3dc7d7750ad496b.77691@xxxxxxxxxxxxxx
i am so glad of all your answers, but...i dont understand ..
anyway i have to give an unniversity exam about fortran and now i am doing
programs to exercising.
we'll have to write a program, and i don't know how it will be.
i only know that the teacher asks for programs like sorting algorithms.
i can sort a mono-dimensional array.
but i don't know how to sort a 2d array!!
maybe i can try to rebuild the array, finding the first max in all the
array and put it into another array => new_mat(1,1)
then i will find the second max and place it to new_mat(1,2) and so on...
what do you suggest me ?
Let's take a simple example :
Suppose you have the following initial matrix; 4 rows 3 columns
row(1) 12 10 7
row(2) 4 8 11
row(3) 9 5 2
row(4) 1 3 6
After the sort what do you expect to see ?
(a) Sorted ascending in both column and row
row(1) 1 2 3
row(2) 4 5 6
row(3) 7 8 9
row(4) 10 11 12
or
(b) data in each row ascending, but row order unchanged
row(1) 7 10 12
row(2) 4 8 11
row(3) 2 5 9
row(4) 1 3 6
or
(c) data in each column ascending, column order unchanged
row(1) 1 3 2
row(2) 4 5 6
row(3) 9 8 7
row(4) 12 10 11
or ...
Now do you see how difficult it is ?
You need to know exactly what you are trying to sort, and why.
Les
.
- Follow-Ups:
- References:
- Prev by Date: Re: convert f77 code from mixed case to lower case
- Next by Date: Re: simplest way to sort a bi-dimensional array? mat(a,b)...
- Previous by thread: Re: simplest way to sort a bi-dimensional array? mat(a,b)...
- Next by thread: Re: simplest way to sort a bi-dimensional array? mat(a,b)...
- Index(es):
Relevant Pages
|
|