Add a sortByPriorityQueue() method

Add a sortByPriorityQueue() method