comp.lang.ada
 help / color / mirror / Atom feed
From: Petter Fryklund <petter.fryklund@atero.se>
Subject: Re: multidimensional sort
Date: Tue, 17 Mar 2020 05:56:39 -0700 (PDT)
Date: 2020-03-17T05:56:39-07:00	[thread overview]
Message-ID: <22e890a6-0be9-4c84-8108-5fdc24c57915@googlegroups.com> (raw)
In-Reply-To: <2e1f10ed-a442-4c69-a97c-5f184940a245@googlegroups.com>

Den tisdag 17 mars 2020 kl. 13:31:43 UTC+1 skrev Gilbert Gosseyn:
> I want to sort an n-dim array by ascending dimensions and ascending elements as keys, in Ada. For example:
> consider an array with n = 5 like:
> 
> ((5, 8, 21, 37, 46), (5, 7, 12, 19, 26),
>  (10, 12, 19, 33, 44), (7, 8, 34, 36, 38), (5, 11, 12, 27, 32), (10, 
>   16, 30, 41, 45), (10, 13, 19, 40, 45), (10, 11, 18, 32, 41), (11, 
>   28, 34, 37, 38))
> 
> which shall become
> 
> ((5, 7, 12, 19, 26), (5, 8, 21, 37, 46), (5, 11, 12, 27, 32), (7, 8, 
>   34, 36, 38), (10, 11, 18, 32, 41), (10, 12, 19, 33, 44), (10, 13, 
>   19, 40, 45), (10, 16, 30, 41, 45), (11, 28, 34, 37, 38))
> 
> How to store, how to sort, and how to deallocate the original?
> 
> Thank you for your advice.

This looks very much like homework. Have a look at Ada.Containers.Indefinate_Vectors and the generic procedure Generic_Sorting.


Regards,
Petter 

  reply	other threads:[~2020-03-17 12:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 12:31 multidimensional sort Gilbert Gosseyn
2020-03-17 12:56 ` Petter Fryklund [this message]
2020-03-17 17:24   ` Simon Wright
2020-03-17 20:16     ` Simon Wright
2020-03-17 16:08 ` Jeffrey R. Carter
2020-03-17 17:10 ` Optikos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox