You are given a set of n points on the number line. They are given in arbitrary order. The task is to find the points that are closest to each other.

 


 

You are given a set of n points on the number line. They are given in arbitrary order. The task is to find the points that are closest to each other.

To solve the problem you decide to take one point and compute its distance to all other points and repeat this process for all points. During the process you track the closest pair.

What is the running time of this algorithm ?

 

  1. O(nlgn)
  2. O(n^2)
  3. Runtime is independent of n.
  4. O(log n)

 

The answer is

.


Comments

Popular posts from this blog

how to download and install secure exam browser for Accenture test

How to create Simple Company Website with Admin Panel in PHP | Free Source Code Download

SAP Labs Hiring Associate Developer (2022/2021 Batch)

Capgemini Engineering PSS hiring for-Engineering MCA Batch 2020/2021/2022

Amazon Hiring Cloud Support Associate (2022/2021 Batch)