Created
November 30, 2017 14:45
-
-
Save bmyerz/0fba250de87cb33b5b2c16868107014a to your computer and use it in GitHub Desktop.
This file contains 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
void sort(int[] number) | |
{ | |
PriorityQueue<Integer, Integer> p = new HeapPriorityQueue(); | |
// insert array data into p | |
for (int i=0; i< number.length; i++) { | |
p.insert(x, x); | |
} | |
// take out in sorted order putting into the array | |
int i = 0; | |
while (!p.isEmpty()) | |
{ | |
number[i] = p.deleteMin(); | |
i++; | |
} | |
// x is number sorted | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment