Question: Design a data structure that can perform the given operations in the stated worst-case running time: Insert: O(lg n) Maximum: O(1) Minimum: O(1) Extract-max: O(lg
Design a data structure that can perform the given operations in the stated worst-case running time:
Insert: O(lg n) Maximum: O(1) Minimum: O(1) Extract-max: O(lg n) Extract-min: O(lg n)
This will be a single data structure, not a different data structure for each operation. Keep in mind that it must have this performance for all of the methods at once, so a heap does not satisfy the requirements a heap has O(1) performance for extract minimum or extract maximum, but not both at the same time. You will need to use a data structure that we have discussed, but make some modifications to it to meet the requirements.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
