Need help with this question

Revision en1, by Joie_SCode, 2021-09-16 10:48:56

Shortest Path among co-ordinates ====================================

Given (N+1) points. All the N points lie on x- axis. Remaining one point (HEAD point) lies anywhere in the coordinate plane. Given a START point on x- axis.

Find the shortest distance to cover all the points starting from START point.We can traverse a point multiple times.

Example -

N+1=4

points on x axis (0,0),(1,0),(2,0)

HEAD Point (1,1) // only head point can lie anywhere ,rest all will lie on x axis

START Point (1,0)

Shortest path -

(1,0) → (2,0) → (1,1) → (0,0) Length of path → 1 + 1.414 + 1.414.

Pls help me with the logic / code

Tags #dynamic programming, #graph

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Joie_SCode 2021-09-16 10:49:34 37 Tiny change: 'inates**\n==================================== \n\nGiven ' -> 'inates**\n\n\nGiven '
en1 English Joie_SCode 2021-09-16 10:48:56 678 Initial revision (published)