Labels

Showing posts with label MST. Show all posts
Showing posts with label MST. Show all posts

Tuesday, March 1, 2011

UVA - 10600 - ACM Contest and Blackout


  • ID : UVA - 10600 - ACM Contest and Blackout
  • Status : Accepted
  • Type : Graph MST .
  • Time : 2 Hours to Submission.
  • Language : Java
  • Solution :
          1. Find MST
          2. Find MST in every time you remove an edge from the Original MST
  • Problems :
          1. Make sure the MST is not the Original MST by removing the edges from the original MST and looping through all edges.
          2. Make sure the second minimum MST is larger than the Original MST.


Monday, February 28, 2011

UVA - 11631 - Dark Roads


  • ID : UVA - 11631 - Dark Roads
  • Status : Accepted
  • Type : Graph MST .
  • Time : 30 Minutes to Submission.
  • Language : Java
  • Solution :
          1. Add Total Costs of Edges.
          2. Kruskal MST on Edges using Union-Find Algorithm
          3. Subtract the MST cost from the Total cost.
  • Problems :
          1. Large Data Input so Buffered Reader & Scanner will give TLE
          2. Don't Use Java Standard Input readers but use this Parser Instead.



UVA - 10307 - Killing Aliens in Borg Maze


  • ID : UVA - 10307 - Killing Aliens in Borg Maze
  • Status : Accepted
  • Type : Graph MST & BFS.
  • Time : 5 Hours to Submission.
  • Language : Java
  • Solution :
          1. Assume 'S' is a normal node as 'A'
          2. BFS on all Nodes and Find all Edges.
          3. Kruskal MST on Edges using Union-Find Algorithm
  • Problems :
          1. hashCode() Function shouldn't be implemented without equals()
          2. Hashing should be avoided with pre-indexing.