1 votes 1 votes Hash table with 6 slots No of keys=8. Collisions are resolved by chaining. Expected no of non empty slots? DS made-easy-test-series data-structures hashing + – akashsheoran asked Nov 6, 2016 • recategorized Mar 4, 2019 by akash.dinkar12 akashsheoran 657 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes EXPECTED NO OF NON EMPTY SLOTS HAVING 'M' KEYS AND 'N' SLOTS IS=N(1-(1-1/N)^M) HERE M=8 AND N=6 SO NO OF NONEMPETY SLOTS =6(1-(5/6)^8) =4.6 santhoshdevulapally answered Nov 6, 2016 santhoshdevulapally comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Sushant Gokhale commented Nov 25, 2016 i edited by Sushant Gokhale Nov 26, 2016 reply Follow Share Hey guys. I think the formula is wrong. Consider that there are 3 keys and 2 slots. =========================== Answer by above approach = 2.(1 - (1 - $\frac{1}{2}$ )3 ) = 2. $\frac{7}{8}$ = $\frac{14}{8}$ ============================== Now, considering the definition of expected value: Let X denote the number of slots filled. X: 1 2 P(X): 1/8 6/8 Thus, answer = 1 * 1/8 + 2 * 6/8 = $\frac{13}{8}$ ******************************************* The above computation is wrong since for X=1, P(X) should be 2/8. So, expected val=14/8 0 votes 0 votes thor commented Nov 26, 2016 reply Follow Share Understand at your own risk : https://gateoverflow.in/4916/hashing 0 votes 0 votes Sushant Gokhale commented Nov 26, 2016 reply Follow Share @abcd2. I took the wrong probablity for X=1. Editing the comment. 0 votes 0 votes Please log in or register to add a comment.