Ruby function to calculate average search time for a skip list -


i'm trying write ruby function determine average expected search time skip list. don't have strong math background , believe results i'm getting function not correct.

n = number of elements in list

base = denominator of promotion probability. i.e. if 1 of 4 nodes promoted base = 4

def lookup_eficiency(n, base)   return (math.log(n, base)*(base/2.0)) end 

how express equation in ruby take number of elements in skip-list , base , return average search time?

since complexity of skip list o(logbase(n/base)), how ?

def lookup_efficiency(n, base)   math.log(n/base)/math.log(base) end 

make sure base float don't end integer division !


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -