modify dynamic array and priority queue