I am trying to implement the closest pair problem in Python using divide and conquer, everything seems to work fine except that in some input cases, there is a wrong answer. My
You just need to change the seventh line in your closestSplitPair function def from best=(Sy[i],Sy[i+j])
to best=dist(Sy[i],Sy[i+j])
and you will get the correct answer: ((94, 5), (99, -8), 13.92838827718412).
You were missing the calling to the dist function.
This was pointed out by Padraic Cunningham's answer as the first problem.
Best Regards.