You are comparing two numbers by subtracting them!
if integer two > than integer one
then it return a positive number , zero if they are equal and a negative number if integer two is less than integer one. Using your code , it will order from highest to lowest if I'm not mistaken( I'm not sure!.... any the order is irrelevant). Then when you are adding the numbers at:
, it will use the sorting algorithm to store the values in the queue rather than using FIFO.
Now I have a question to you vijay, by looking your comparator implementation, is the output: 9,8,7,6,5,3,1 when traversing ?