We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
When you need to sort the data but keep track of the original index positions, use a pair-index structure. In the code below, the 'quickSort()` routine sorts by price in non-increasing order and for elements that have have the same price, it sorts by index in increasing order.
Minimum Loss
You are viewing a single comment's thread. Return to all comments →
When you need to sort the data but keep track of the original index positions, use a pair-index structure. In the code below, the 'quickSort()` routine sorts by price in non-increasing order and for elements that have have the same price, it sorts by index in increasing order.