CompNetwork 36

0. Which one of the following hash functions on integers will distribute keys most uniformly over 10 buckets numbered 0 to 9 for i ranging from 0 to 2020?

  • Option : C
  • Explanation :
    Using concept of power of cycle:
    (A) (0,1,4,9,6,5,6,9,4,1,0) repeated
    (B) (0,1,4,9,6,5,6,9,4,1,0) repeated
    (C) (0,1,8,7,4,5,6,3,2,9) repeated
    (D) (0,2,4,6,8) repeated
    So, only h(i) =i3 mod 10 covers all the digits from 0 to 9.
    Option (C) is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *