[OT] Algorithm question
Ivan Kazmenko via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 2 04:27:17 PDT 2017
On Tuesday, 2 May 2017 at 10:35:46 UTC, Ivan Kazmenko wrote:
> I hope some part of the idea is still salvageable.
> For example, what if we put the intervals in a queue instead of
> a stack?
I tried to implement a similar approach, but instead of a queue
or a stack, I used a random-access array of intervals.
Sadly, it is still far from uniform, since it does not take
interval lengths into account, and I don't see how to do that
without at least O(log n) time per interval insertion or deletion.
Implementation and empiric frequencies for n=5 elements in a
permutation: http://ideone.com/3zSxLN
Ivan Kazmenko.
More information about the Digitalmars-d
mailing list