Last active
September 25, 2015 05:29
-
-
Save sherman/5e5a75ead1a533a622e6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static long[] sortIterative(long[] data) { | |
Queue<long[]> q = new LinkedList<>(); | |
for (long elt : data) { | |
q.add(new long[]{elt}); | |
} | |
while (q.size() > 1) { | |
long[] res = mergeSorted(q.poll(), q.poll()); | |
q.add(res); | |
} | |
return q.poll(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment