Please read the new rule regarding the restriction on the use of AI tools. ×

Wrong ordering in binaryheap

Revision en2, by skloj, 2016-05-17 02:20:56

I am using the BinaryHeap offered by D language:

import std.stdio, std.container;
void main() {
  auto q = heapify(Array!int([44, 22, 100, -1, 0, 5, 6, 7]));
  while (!q.empty) {
    write(q.front, " ");
    q.removeFront;
  }
}

In my machine (or even on ideone) I got the elements sorted. But in codeforces I got this strange ordering:

44 100 22 7 6 5 0 -1

===== Used: 0 ms, 2856 KB

The codeforces version of D (v2.069.2) is even newer than ideone (v2.067.1), but it is older than my installation (v2.071.0).

Do you know why is the reason? Thank you very much.

Tags dlang

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English skloj 2016-05-17 02:20:56 48
en1 English skloj 2016-05-17 01:57:18 708 Initial revision (published)