Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Apply the algorithm described in Example12 for finding the closest pair of points, using the Euclidean distance between points, to find the closest pair of the points

(1,2),(1,6),(2,4),(2,8),(3,1),(3,6),(3,10),(4,3),(5,1),(5,5),(5,9),(6,7),(7,1),(7,4),(7,9)and (8,6).

Short Answer

Expert verified

The minimum distance of 2 between B andF.

Step by step solution

Achieve better grades quicker with Premium

  • Unlimited AI interaction
  • Study offline
  • Say goodbye to ads
  • Export flashcards

Over 22 million students worldwide already upgrade their learning with Vaia!

01

Given expression

Given points are:

(1,2),(1,6),(2,4),(2,8),(3,1),(3,6),(3,10),(4,3),(5,1),(5,5),(5,9),(6,7),(7,1),(7,4),(7,9),(8,6).

02

Definition of Euclidean distance

In mathematics, the Euclidean distance between two points in Euclidean space is the length of a line segment between the two points.

Formula:

d(p,q)=i=1nqi-pi2

p,q=Two points in Euclidean n-space

qi,pi=Euclidean vectors, starting from the origin of the space (initial point)

n=n-space

03

Sort the points in increasing order and plot them on a graph

Sort the points in increasing order of thex-coordinates:

A=(1,2),B=(1,6),C=(2,4),D=(2,8),E=(3,1),F=(3,6),G=(3,10),H=(4,3)

I=(5,1),J=(5,5),K=(5,9),L=(6,7),M=(7,1),N=(7,4),O=(7,9),P=(8,6)

Divide the list into sub lists until it obtains sub lists of two elements each.

04

Determine the closest pair of the given point by the Euclidean distance formula

Distance formula: dx1,y1,x2,y2=x2-x12+y2-y12

When the list contains n=2elements, then the distance "Dis" between the two points is the minimum distance.

localid="1668578491443" Dis(A,B)=(1-1)2+(6-2)2

Dis(A,B)=16

Dis(A,B)=4

Similarly, Dis(C,D)=4,Dis(E,F)=5,Dis(G,H)=52,Dis(I,J)=4

Dis(K,L)=5,Dis(M,N)=3,Dis(O,P)=10

Next, compute the minimum distance among the lists.

{A,B,C,D},{E,F,G,H},{I,J,K,L},{M,N,O,P}

Dis(A,B,C,D)=min(Dis(A,B),Dis(C,D),Dis(Elements of both lists)

Aand Care the points that are closest together, with one point in each sublist.

localid="1668589125973" Dis(A,B,C,D)=min4,4,(2-1)2+(4-2)2

Dis(A,B,C,D)=min(4,4,5)

Dis(A,B,C,D)=5

Dis(E,F,G,H)=min(Dis(E,F),Dis(G,H),Dis(Elements of both lists)

Eand Hare the points that are closest together, with one point in each sublist.

localid="1668593243094" Dis(E,F,G,H)=min5,52,(4-3)2+(3-1)2

Dis(E,F,G,H)=min(5,52,5)

localid="1668593254682" Dis(E,F,G,H)=5

Dis(I,J,K,L)=minDis(I,J),Dis(K,L),Dis(Elements of both lists))

Jand Lare the points that are closest together, with one point in each sublist.

Dis(I,J,K,L)=min4,5,(6-5)2+(7-5)2

Dis(I,J,K,L)=min(4,5,5)

Dis(I,J,K,L)=5

localid="1668589518830" Dis(M,N,O,P)=minDis(M,N),Dis(O,P),Dis(Elements of both lists))

NandPare the points that are closest together, with one point in each sublist.

Dis(M,N,O,P)=min3,10,(8-7)2+(6-4)2

Dis(M,N,O,P)=min(3,10,5)

Dis(M,N,O,P)=5

05

Compute the minimum distance and find

Compute the minimum distance among the lists.

{A,B,C,D,E,F,G,H},{I,J,K,L,M,N,O,P}

Dis(A,B,C,D,E,F,G,H)=min(Dis(A,B,C,D),Dis(E,F,G,H),Dis(Elements of both lists)

The line separates the points in the two sub-lists are x=4.5.

role="math" localid="1668590936318" d=min(Dis(A,B,C,D),Dis(E,F,G,H))

d=min(5,5)

d=5

Now, only need to check the distance between the points with x-coordinates in (4.5-5,4.5-5)which are all points while the y-coordinates can differ by at most d=5

While the pair BFhas the shortest distance,

Dis(A,B,C,D,E,F,G,H)=min5,5,(3-1)2+(6-6)2

Dis(A,B,C,D,E,F,G,H)=min(5,5,2)

Dis(A,B,C,D,E,F,G,H)=2

06

Find the minimum distance in the total list

Dis(I,J,K,L,M,N,O,P)=min(Dis(I,J,K,L),Dis(M,N,O,P),Dis(Elements of both lists)

Finally, compute the minimum distance in the total list.

Dis(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P)=min(Dis(A,B,C,D,E,F,G,H),Dis(I,J,K,L,M,N,O,P),Dis(Elements of both lists)

Dis(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P)=2

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

In this exercise we construct a dynamic programming algorithm for solving the problem of finding a subset S of items chosen from a set of n items where item i has a weight , which is a positive integer, so that the total weight of the items in S is a maximum but does no exceed a fixed weight limit W. Let M(j,w)denote the maximum total weight of the items in a subset of the first j items such that this total weight does not exceed w. This problem is known as the knapsack problem.

a) Show that ifwj>w, thenM(j,w)=M(j-1,w).
b) Show that if wjw, thenM(j,w)=max(M(j-1,w),wj+Mj-1,w-wj).
c) Use (a) and (b) to construct a dynamic programming algorithm for determining the maximum total weight of items so that this total weight does not exceed W. In your algorithm store the valuesM(j,w) as they are found.
d) Explain how you can use the values M(j,w)computed by the algorithm in part (c) to find a subset of items with maximum total weight not exceeding W.

Find f(n)when n=2k, where fsatisfies the recurrence relation f(n)=f(n/2)+1with f(1)=1.

Suppose that in Example 8of Section 8.1a pair of rabbits leaves the island after reproducing twice. Find a recurrence relation for the number of rabbits on the island in the middle of the nth month.

Determine a value for the constant Cin Example 4 and use it to estimate the number of bit operations needed to multiply two 64-bit integers using the fast multiplication algorithm.

Find the solution to the recurrence relation,

\(f\left( n \right) = f\left( {\frac{n}{2}} \right) + {n^2}\)

For \(n = {2^k}\)

Where \(k\) is a positive integer and

\(f\left( 1 \right) = 1\).

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free