How do i make a data structure for stock of boxes so i can implement the following methods as efficient as possible?
All boxes have a square base (length=width) but they are not necessarily cubes (height not necessarily equals to length=width).
The functions are
INSERTBOX(side, height) (side=length=width) - An insertion of a new box to the data structure
REMOVEBOX(side, height) - A deletion of a box from the stock
GETBOX(side, height) - Returns a box with minimal volume that its length is at least side and its height is at least height
CHECKBOX(side, height) - Check if there is a box in the data structure that its length is at least side and its height is at least height
The way i think to implement this is by a RB Tree with the key of volume but then if i find the box with required volume i don't know how to find among those potential boxes (the subtree of the minimal volume) the one with the minimal dimensions that meet the requirements.
Any hints? Is this the right way? Or should i think of other data structures?