Question: . In class, we discussed the on - line kth largest problem. We solved it , using an augmented AVL - tree structure, with the
In class, we discussed the online kth largest problem. We solved it using an augmented AVLtree structure, with the following characteristics:
Insertx in time and space Ologn where n is the number of elements in the structure at this time ie the number of insert operations, minus the number of Delete operations, up until now.
Deletex in time space Olognwhere n is the number of elements in the structure at this timeie the number of insert operations, minus the number of Delete operations, up until now.
Findk in time Ologn and space O where n is the number of elements in the structure at this time. ie the number of insert operations, minus the number of Delete operations, up until now.
Suppose that instead of doing the findk operation, with k an arbitrary positive
An integer that can vary from one Find to the next, we replace it by
Findn
Where n is the number of all elements that are currently stored in the structure. Can you devise a data structure and algorithms for
Insertx
Deletex
Findn
Which improve over Findk approach discussed in class Obviously that approach will still apply, so we know that all three operation can certainly be done in time and space Ologn;however, the question for you to solve is: Can you do better??
Carefully formulate your data structure outline the three algorithms in some detail, and determine with care the time and space complexities of your three algorithms.
If your structuresalgorithms are based on standard structuresalgorithms emphasize in what way yours are different. Do not repeat everything!
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
