Ranges/algorithms for aggregation
bearophile
bearophileHUGS at lycos.com
Fri Mar 21 09:04:44 PDT 2014
Luís Marques:
> So let's just say that the client is unclear on his
> requirements, which does happen in the real world anyway :-).
Yes, it happens, But it's a problem, because often if you know
what you need you can produce the results more efficiently :-)
> (did anyone actually implement it?)
Not yet.
> I'm not sure how if "a dynamic arrays of dynamic arrays of
> 2-tuples" sufficed that would help with the intermediate step,
> if we wanted to avoid the sorting step. Did you have anything
> in particular in mind there?
I think this problem needs a sorting or a hash. One possible
solution, if you don't need an associative array as output, is to
use a multiSort followed by a building of groups using slicing.
It could be efficient enough. Later you search the keys with a
some kind of binary search.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list