On Monday, 28 December 2015 at 14:05:42 UTC, Ivan Kazmenko wrote:
1. You can find maximum, then second maximum, then third
maximum and so on - each in constant memory and linear time.
So, if performance is somehow not an issue, there is a way to
do it @nogc but in N^2 operations.
That's perh
On Monday, 28 December 2015 at 12:58:36 UTC, Gary Willoughby
wrote:
On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko
wrote:
Or do you mean you want to print variables in order without
modifying the array? Sounds like this would require at least
N log N time and N additional memory fo
On Sunday, 27 December 2015 at 22:42:21 UTC, Ivan Kazmenko wrote:
If you implement a struct with range primitives over it, you
can use it as a range.
See the second code example in std.container.binaryheap's docs
at
http://dlang.org/phobos/std_container_binaryheap.html#.BinaryHeap.
Or do you
On Sunday, 27 December 2015 at 20:01:47 UTC, Gary Willoughby
wrote:
On Sunday, 27 December 2015 at 17:23:35 UTC, Gary Willoughby
wrote:
I have a binary tree storing ints implemented using an array.
The internal state looks like this:
8,7,6,4,1,3,5,2
When extracting this data, it is returned a
On Sunday, 27 December 2015 at 17:23:35 UTC, Gary Willoughby
wrote:
I have a binary tree storing ints implemented using an array.
The internal state looks like this:
8,7,6,4,1,3,5,2
When extracting this data, it is returned as 8,7,6,5,4,3,2,1.
Is it possible to elegantly add a range on top of
I have a binary tree storing ints implemented using an array. The
internal state looks like this:
8,7,6,4,1,3,5,2
When extracting this data, it is returned as 8,7,6,5,4,3,2,1.
Is it possible to elegantly add a range on top of the internal
state to return the correct value order I would expect