Gaurav
2011-07-29 19:31:17 UTC
Looking at Module 6, Slide 3:
Can anyone explain why the Interpolation search involves values at
all? Won't the values for the keys be modified? Wouldn't that give us
a different outcome for the same array?
Eg: A = [3, 4, 6, 7, 19, 22, 27, 34, 54, 99,]
Interpolation Search (A[0, 8], 4) would ask us to check for: 0 +
floor[ ( (4 - A[0]) / (A[8] - A[0]) ) * (8 - 0) ] = floor[ ( 1 /
(54 - 3) ) * 8 ] = 0
While different values would have given us a different outcome.
Am I correct in understanding this?
Can anyone explain why the Interpolation search involves values at
all? Won't the values for the keys be modified? Wouldn't that give us
a different outcome for the same array?
Eg: A = [3, 4, 6, 7, 19, 22, 27, 34, 54, 99,]
Interpolation Search (A[0, 8], 4) would ask us to check for: 0 +
floor[ ( (4 - A[0]) / (A[8] - A[0]) ) * (8 - 0) ] = floor[ ( 1 /
(54 - 3) ) * 8 ] = 0
While different values would have given us a different outcome.
Am I correct in understanding this?