Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
am trying to find the average number of comparisons in linear, binary, and Interpolation search and I found that by using this (log2(log2N)) we can find the average number of comparisons in interpolation

but I could not represent this (log2(log2N)) as a java code and am not sure if it is right

What I have tried:

double average_seq = (n +1 ) /2;
         double  average_bin = Math.log(n) / Math.log(2);
         double average_inte = Math.log(2)/Math.log(Math.log(n)) ;
Posted
Updated 27-Oct-21 9:15am

1 solution

If
log2(N) = log(N) / log(2)
, then
log2(log2(N)) = log2(log(N) / log(2)) = log(log(N) / log(2)) / log(2)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900