ANALYSIS & DESIGN OF ALGORITHMS subject
Three points P, Q, and R are said to be collinear if they are on a single line. To check whether the 3 points lie on the same line, we use the distance formula. If P, Q and R are three collinear points, then:
Distance from P to Q + Distance from Q to R = Distance from P to R
PQ + QR = PR
The distance between two points (x1, y1) and (x2, y2) is given by
Hence, we can easily find the distance between the points P, Q and R, with the help of this formula.
Design an algorithm (pseudocode) to check whether three points are collinear. In your solution include the input and the output.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here