Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

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?

0
10 Posted

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?

0
10

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.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.