### hongjun-7's blog

By hongjun-7, history, 8 years ago,
1. Smallest Enclosing Circle : 2-Dimension Problem (Written in Korean. Output is the smallest enclosing circle's position on the first line and the radius on the second line.)

2. Smallest Enclosing Sphere : 3-Dimension Problem

Let P(X, Y, Z) = (Average(x(i)), Average(y(i)), Average(z(i)))

Average(x(i)) = Sum(x(i)) / N

Average(y(i)) = Sum(y(i)) / N

Average(z(i)) = Sum(z(i)) / N

P is inside of the points' convex hull.

Now find the farthest point(M) to P.

Move P toward M a little bit and the ratio should be small and decreasing.

If there is no such a movement, that is the answer.

Total Time Complexity is O(N * constant number)

(We can reduce 'N' by getting convex hull.)

My 2-Dimension Problem's Solution Code

My 3-Dimension Problem's Solution Code

• +55

 » 8 years ago, # |   +5
•  » » 8 years ago, # ^ |   0 The 3-Dimension Problem I linked is this. Thanks.
 » 8 years ago, # |   -45 Could you please explain the code for 2D ??
•  » » 8 years ago, # ^ |   +3 Online contest is going on dude!!
 » 5 years ago, # |   +7