Блог пользователя Joie_SCode

Автор Joie_SCode, история, 3 года назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится