added heap sort and optimized priority queue