I am given N lines, i.e, I am given a,b,c for N lines. And each line is of the form ax + by + c = 0. I need to find out the maximum number of lines that are parallel to each other.
For this, first I create a 2 dimensional array of the ratio A/B (-slope) and C/B (-intercept), except for b == 0 (for which I take slope as 1/eps , I have defined eps as a very small positive number).
Then I remove the duplicate entries in $O(n^2)$ complexity.
Again I do $O(N^2)$ scans to find how many lines for a given slope exist and report the maximum number.
It turns out that this a slower way of doing this. How can I make this faster ?
Also, I am writing my code in C++.
atan2(b,a)
)and check how long the longest run of equal slopes is