Replace Elements By Its Rank In The Array Using Heap