Finding the distance between the two closest elements in an array of numbers?

One obvious efficiency improvement: sort the integers first, then you can look at adjacent ones. Any number is going to be closest to its neighbour either up or down.

First of all, before making it fast, make it correct. Why is dmin initialized with the length of the array? If the array is 1, 1000, the result of your algorithm will be 2 instead of 999.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions