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.

Reply via email to