Minimum Spanning Tree Manhattan Distance Problem Solution

ps bonus debrief by le beier n.w
1 / 24
Embed
Share

"Explore the solution to finding a minimum spanning tree for a set of points based on Manhattan distance in this informative visual guide. Learn about pruning the graph and optimizing algorithms for efficient computation."

  • Tree Algorithm
  • Manhattan Distance
  • Graph Optimization
  • Solution
  • Pruning

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. PS Bonus Debrief By Le Beier

  2. Problem Given N points(x, y), the weight between each pair of points are given by the manhattan distance. Find a minimum spanning tree(MST) manhattan distance = |X1- X2| + |Y1-Y2|

  3. Constraints 1 <= N <= 100, 000 0 <= (x, y) <= 1000 Remove Duplicates Points are non-distinct edge weight = manhattan distance

  4. Naive Solution

  5. For i = 0 n: For k = 0 n: Add edge(point_i, point_k, dist) into Edge List Result = MST(Edge List)

  6. O(N^2) + O(E log N) = O(N^2 log N) * E = N^2 Since N = 100000 100000^2 log 100000 = 166096404744 166096404744

  7. TLE TLE AC Solution

  8. Prune the graph How?

  9. 10 Edges

  10. 28 Edges

  11. O(XY)+O(XY log XY) = O(XY log XY) Note: 0<= X, Y < 1000 O(1000000 log 1000000) = 19931568

  12. Can we do better?

  13. Delaunay Triangulation Using line sweep algorithm which runs in O(n log n)

  14. https://www.topcoder.com/communi ty/data-science/data-science- tutorials/line-sweep-algorithms/

Related


More Related Content