Im using C++ and the distance between the closest pair is zero even when n is small since there are two identical points. Should that be happening?
Please load a new copy of lab1.cc from the web page. You can directly save that one page or get a new copy of everything and unzip it (but be careful to do this in a different directory so you don’t lose any changes you made to the other files). The problem was caused by the fact that the abs and mod functions both returned integers versus doubles. The solution used was just to compute these functions directly. Note that none of your code will need to be changed because of this — It will just generate more interesting data sets. Finally, I added a sample protytpe for the brute force and divide and conquer closest pair algorithms. You can replace those by whatever prototype you need.