Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

[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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions