Question: [4 marks] Efficient a-closeness detection. Given a non-negative integer number a we say that integers x and y are a-close if xya. Given a list

 [4 marks] Efficient a-closeness detection. Given a non-negative integer number a

[4 marks] Efficient a-closeness detection. Given a non-negative integer number a we say that integers x and y are a-close if xya. Given a list of n integers x1,,xn and an integer a0, the a-closeness detection problem is to find out if there are two entries xi,xj(i=j) in this list which are a-close. Design an efficient algorithm for this problem. The input is a list of integers and a. The output is TRUE (if a-close entries are found) or FALSE (if all pairs xi,xj are not a-close). Your algorithm must have running time in o(n2). Describe the main idea of your algorithm first, present clearly written pseudocode and worst case running time analysis of your algorithm. Show that the running time of your algorithm is indeed in o(n2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!