Question: In the clearable list problem, we maintain a singly - linked list under the following two update operations: INSERT, which inserts an element into the
In the clearable list problem, we maintain a singlylinked list under the
following two update operations:
INSERT, which inserts an element into the list, and the newly inserted element
will become the list head;
CLEAR, which removes all the elements from the list.
It is easy to see that INSERT can be performed in O worstcase time, while CLEAR
can take On time in the worst case, where n is the number of operations performed
so far starting from an initially empty list.
Your task is to show that the amortized times of performing INSERT and CLEAER are
both O
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
