Tuesday, March 4, 2014
Sunday, March 2, 2014
Solution:See it in the comment.
Saturday, March 1, 2014
Problem:TopCoder SRM170 Div1 - Level II
Solution:This problem demonstrates how we implement the solution with real understanding of the algorithm.
After reading the the problem, the time it asking is the distance between two cities, and we need to know the maximum distance between any two cities with the minimum cost. It's like Max(min1, min2, min3, ...)
When asking about distance between any two nodes, the first choice is always Floyd algorithm, which is a O(n^3) algorithm. But here, the way we calculate the distance needs our tention. When we were asking about the distance between two cities, it's not going be the sum of two distance, instead, it will be maximum of two costs.