Re: How to sort a vector and then append data
From: Catherine Rees Lay (spamtrap_at_polyhedron.org.uk)
Date: 07/30/04
- Next message: David Jones: "Re: How to sort a vector and then append data"
- Previous message: denis: "Performance degradation from PGF90-Xeon to Compaq F90-Alpha"
- In reply to: joel GUERRERO: "How to sort a vector and then append data"
- Next in thread: David Jones: "Re: How to sort a vector and then append data"
- Reply: David Jones: "Re: How to sort a vector and then append data"
- Reply: Paul Van Delst: "Re: How to sort a vector and then append data"
- Reply: joel GUERRERO: "Re: How to sort a vector and then append data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jul 2004 10:12:49 +0100
In article <bc7de858.0407291749.a785b3c@posting.google.com>, joel
GUERRERO <joegi.geo@yahoo.com> writes
>Hi,
>I'm not very experienced using fortran 90, and probably this will
>looks a stupid question for you.
>
>I need to sort a vector and then append the missing data that is:
>
>Suppose that we have the following vector: 3 1 2 5 15
>
>I need to sort it, that is i need to get: 1 2 3 5 15
>
>and then append the missing numbers in order to get the following
>vector:
>
>1 2 3 -4- 5 -6- -7- -8- -9- -10- -11- -12- -13- -14- 15
>
>Hoper you can help me,
>
>Joel
OK, that's bizarre, because there's no need to do ANY sorting to get
your desired answer. Just find the maximum value in your vector,
allocate a new one that long, and set each element equal to its index.
Much more efficient than sorting. You'll also need the minimum value and
an offset if your minimum value isn't necessarily 1.
Of course, if this is a homework problem, you'll have to do it the way
you describe. Have a go first and you'll get lots of help here, ask
others to do the work for you and you generally won't.
Catherine.
-- Catherine Rees Lay To email me, use my first name in front of the "at".
- Next message: David Jones: "Re: How to sort a vector and then append data"
- Previous message: denis: "Performance degradation from PGF90-Xeon to Compaq F90-Alpha"
- In reply to: joel GUERRERO: "How to sort a vector and then append data"
- Next in thread: David Jones: "Re: How to sort a vector and then append data"
- Reply: David Jones: "Re: How to sort a vector and then append data"
- Reply: Paul Van Delst: "Re: How to sort a vector and then append data"
- Reply: joel GUERRERO: "Re: How to sort a vector and then append data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|