我在1月份的算法考试中失败了。我明天要去口试。我正在通过普通的考试和答案,当有答案时我无法理解。
根据答案,答案是A.为什么? 20 mod 7是6,但12 mod 7是5并且它是空的。希望你能在这里帮助我。
PS:抱歉,如果格式错误
答案 0 :(得分:1)
EditText
所以
i k
-------------------------
0 20 (2*20+3*0^2) mod 7 = (40 + 0) mod 7 = 40 mod 7 = 5 <- [e, e, e, e, e, 20, e]
0 12 (2*12+3*0^2) mod 7 = (24 + 0) mod 7 = 24 mod 7 = 3 <- [e, e, e, 12, e, 20, e]
0 5 (2*5+3*0^2) mod 7 = (10 + 0) mod 7 = 10 mod 7 = 3 <- collision
1 5 (2*5+3*1^2) mod 7 = (10 + 3) mod 7 = 13 mod 7 = 6 <- [e, e, e, 12, e, 20, 5]
0 3 (2*3+3*0^2) mod 7 = (6 + 0 ) mod 7 = 6 mod 7 = 6 <- collision
1 3 (2*3+3*1^2) mod 7 = (6 + 3) mod 7 = 9 mod 7 = 2 <- [e, e, 3, 12, e, 20, 5]
0 1 (2*1+3*0^2) mod 7 = (2 + 0) mod 7 = 2 mod 7 = 2 <- collision
1 1 (2*1+3*1^2) mod 7 = (2 + 3) mod 7 = 5 mod 7 = 5 <- collision
2 1 (2*1+3*2^2) mod 7 = (2 + 12) mod 7 = 14 mod 7 = 0 <- [1, e, 3, 12, e, 20, 5]
答案 1 :(得分:1)
答案 2 :(得分:0)
h(20,0) = 5
h(12,0) = 3
h(5,0) = 3*
h(5,1) = 6
h(3,0) = 6*
h(3,1) = 2
h(1,0) = 2*
h(1,1) = 5*
h(1,2) = 0
* collision