I knew k-means from college but kept second-guessing whether the median vs mean distinction actually mattered here.
Start by clarifying the problem constraints and then propose a solution that leverages the separability of L1 distance into independent x and y coordinates. Explain that the problem reduces to a 1D k-median clustering on each dimension, and discuss algorithms like dynamic programming or greedy approaches for the 1D case, noting that the 2D problem is NP-hard in general.
Pro tip: Mention that while the 2D problem is NP-hard, the 1D k-median can be solved optimally in polynomial time, and for large-scale systems like Uber, approximation algorithms or heuristics (e.g., k-means++ with L1) are often used in practice.
Ask about the size of N and K, whether K is fixed or variable, if locations must be chosen from given points or can be arbitrary, and if there are any real-time constraints.
Explain that L1 distance decomposes into independent x and y components, so the total cost is the sum of costs in each dimension. Thus, we can solve two separate 1D k-median problems.
Describe a dynamic programming approach: sort points, precompute costs for any interval, and use DP to partition into K clusters minimizing sum of distances to medians. Time complexity O(N^2 K) or O(N K) with optimizations.
Note that solving each dimension independently gives a set of x-coordinates and y-coordinates for facilities, but the pairing into 2D points may not be optimal. Discuss that the 2D problem is NP-hard, so we might use heuristics or approximation algorithms.
Mention scalability: for large N, use approximation algorithms like k-means++ adapted for L1, or greedy facility location. Also consider if K is small, brute force over combinations might be feasible.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.