Home > Net > A little doubt about interpolation search, feel this algorithm is not very serious
A little doubt about interpolation search, feel this algorithm is not very serious
Time:09-18
Interpolation to find the formula is: mid=low + (high - low) * (k - arr [low])/(arr [high] - arr [low]), then I have a few doubts: The first: (k - arr [low])/(arr [high] - arr [low]) are two type int number division, it is not the result of the almost is zero, which come of proportion? The second: (arr [high] - arr [low]), one thousand arr [high] and arr [low] are equal, the result is 0, that don't become divided by zero error, The above question is when I debug the problems found, is I understand is wrong, or the algorithm itself is not to force, hope your bosses directions
CodePudding user response:
Lagrange interpolation, if you learned the Lagrange, you should know "Lagrange" is on the zero passage
CodePudding user response:
Oh, carefully Chou Chou, this is Newton interpolation