hey, i want to do a question in which i am given n line segments and i want to find the number of intersection of them. Can anyone tell me the most efficient way i can do it ? I have got some links on google and also from books but i am not getting it. I am not asking for code or something like that and neither it is my homework. So please help me if you can. thanks
Jump to Post
Suppose I have 1 line, its doesn't has any intersection so p(1) = 0
Now introducing another line, it cuts p(1) at atmost 1 point so p(2) = 1
Again introduce another line, it will intersect above 2 lines in atmost 2 points, but we already have one intersection point …
All 4 Replies
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.