Question: Algorithm must be in little-o(n^2) not in big-o(n^2). Cannot use a hash table as well. [4 marks] Efficient a-closeness detection. Given a non-negative integer number
Algorithm must be in little-o(n^2) not in big-o(n^2). Cannot use a hash table as well.

[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
Get step-by-step solutions from verified subject matter experts
