Question: Show how to maintain a dynamic set Q of numbers that supports the operation MIN-GAP, which gives the magnitude of the difference of the two
Show how to maintain a dynamic set Q of numbers that supports the operation MIN-GAP, which gives the magnitude of the difference of the two closest numbers in Q. For example, if Q = {1, 5, 9, 15, 18, 22}, then MIN-GAP(Q) returns 18 - 15 = 3, since 15 and 18 are the two closest numbers in Q. Make the operations INSERT, DELETE, SEARCH, and MIN-GAP as efficient as possible, and analyze their running times.
Step by Step Solution
3.20 Rating (169 Votes )
There are 3 Steps involved in it
1 Underlying data structure A redblack tree in which the numbers in the set are stored simply as the ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
C-S-A (72).docx
120 KBs Word File
