--- In [email protected], "Sheri" <[EMAIL PROTECTED]> wrote:
>
> Is is possible to sort or search 2d vectors?
>
Well, as per the help, you can treat as 1Dim and do it that way.

But probably you want to sort a single column and have the others stay
aligned as in a sort of an Excel spreadsheet.

You cannot do that directly.

You can use doublesort as per the help, ie to sort v2, v3, v4 by v1,
create the vector v0 of indices 1 .. n, then double sort v1, v0, and
reference v1[i], v2[v0[i]], etc.
Searches are also tricky, but could be done, I think.


You can also code your own sort to avoid having to use a v0, although
I would not expect it to be fast enought for more that 100 elements or
so.  Check out shell sort in wikipedia.  




Reply via email to