![]() |
VOOZH | about |
Design a data structure that stores items with associated prices (duplicates allowed) while supporting fast insertion, lookup by price, and sorted as well as range-based retrieval of items.
Follow these steps to implement using a simple list:
Implementation
Sorted Data: Book 50 Notebook 50 Pen 100 Pencil 100 Phone 150 Laptop 200 Items at price 100: [Pen, Pencil] Items with price >= 100: Pen 100 Pencil 100 Phone 150 Laptop 200
Follow these steps to implement the efficient solution:
Implementation
Sorted Data: Book 50 Notebook 50 Pen 100 Pencil 100 Phone 150 Laptop 200 Items at price 100: [Pen, Pencil] Items with price >= 100: Pen 100 Pencil 100 Phone 150 Laptop 200