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

This question was previously asked in

GATE CS 2015 Official Paper: Shift 2

Option 2 : β(π) = π^{3} mod 10

IBPS SO IT Officer Mains: Full Mock Test

4845

60 Questions
60 Marks
45 Mins

Consider h(i) = i^{2} mod 10

Last digit of i |
Bucket Number |

0 |
1 |

1 |
4 |

2 |
9 |

3 |
6 |

4 |
5 |

5 |
6 |

6 |
9 |

7 |
4 |

8 |
1 |

9 |
0 |

Consider h(i) = i^{3} mod 10

Last digit of i |
Bucket Number |

0 |
0 |

1 |
1 |

2 |
8 |

3 |
7 |

4 |
4 |

5 |
5 |

6 |
6 |

7 |
3 |

8 |
2 |

9 |
9 |