Question: Design a data structure for the following operations: ( a ) Insert ( S , x ) : Insert x into S in O (
Design a data structure for the following operations:
a InsertS x: Insert x into S in Olog n time.
b Searchx: Search for x in S in Olog n time.
c DeleteS x: Delete x from S In Olog n time.
d M ax GapS: find the maximum difference, maxx,y in S x y between two
elements of S in time O time.
e M in GapS: find the two numbers x y in S such that x y is the smallest,
ie the difference between the closest two numbers: minx,y in Sxyxy in O
time.
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
