recursion - Minimizing cheating of students -
given matrix of size m * n, place k students in such way cheating in exam minimized
what thought :
with brute force approach , create possible combination of students placements , return 1 minimum cheating score, while cheating score defined sum of manhattan distances between each 2 students.
the time & space complexity of approach bad, better solution ?
1) geometric intuition -- perhaps try placing first 4 @ outer corners of square, spiral inwards there?
this approx work "pythagorean distance", maybe can adapt "manhattan distance" equivalent of inward spiralling path & place students linearly along that.
2) or, place students sequentially @ next cheating-minima; then, once students placed, perturb locations achieve "overall minima".
i 2) best approach.
Comments
Post a Comment