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

Автор silent__killer1, история, 7 лет назад, По-английски

Question — You are given a array of 2d coordinates , you need to find out the maximum points lie on a line. where the array length is n<=100000 I am googling alot but i found the answer only when n<=1000 which will be done in o(n^2) . Can anyone share their approach for when n<=100000. Thankyou…

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

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -12 Проголосовать: не нравится

Sort 2d coordinates, and then find the maximum length of subarray with equal x or y coordinates.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

See this blog (section "Radial sweep").

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can you share link of problem? I doubt that it can be done faster than O(N^2) unless approx probabilistic methods are allowed?