I want to define a priority queue where priorities have components in two different currencies. For example, Item A costs 1 USD + 20 yen. This queue has two methods, insert(priceInUsd, priceInYen)
and popMin(exchangeRate)
, which takes a price of a US dollar in yen, and pops the item with the lowest total cost in USD and yen given this exchange rate. How do I implement this?
Here are my ideas so far:
n**(1/3)
things in your convex hull, this is alright on average.There's some prior art that you didn't mention, on the dynamic planar convex hull problem. Brodal and Jacob (FOCS '02) give a data structure that lets you insert a point, delete a point, and find the extreme point in a direction in amortized logarithmic time, which suffices to implement your data structure (though the implementation looks complicated).