Used java.util.PriorityQueue Instead of LinkedList