The core formula isn't hard once you remember it: absolute value of (a*px + b*py + c) divided by sqrt(a squared plus b squared).
Start by clarifying the problem and edge cases, then derive the distance formula from the line equation. Implement a function that iterates through the points, computes the distance using the formula, and handles the degenerate case where a and b are both zero. Discuss time and space complexity and potential optimizations.
Pro tip: Mention that the formula can be derived from the projection of the vector from a point on the line to the given point onto the line's normal vector. Also, explicitly handle the degenerate case by returning an empty list or raising an error, and discuss how to test it.
Confirm input format, output format, and what to do when the line is invalid (a=0 and b=0). Ask if the distances should be absolute values or signed.
Recall that the perpendicular distance from point (x0, y0) to line ax+by+c=0 is |a*x0 + b*y0 + c| / sqrt(a^2 + b^2). Explain why this works geometrically.
If a=0 and b=0, the line is invalid. Decide on behavior: return empty list, raise ValueError, or return None. Justify your choice.
Write a function that iterates through the points, computes the distance for each, and collects results in order. Use a list comprehension or loop.
State time complexity O(n) and space O(n) for output. Suggest test cases: normal line, horizontal/vertical line, degenerate line, and points on the line.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.