0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ハッシュ表に格納する衝突が起こるキーの組合せ

Posted at

AP試験学習記録27年秋 午前5

キーが小文字のアルファベット1文字(a, b, …,z のいずれか)であるデータを,大きさが10のハッシュ表に格納する。ハッシュ関数として,アルファベットのASCIIコードを10進表記法で表したときの1の位の数を用いることにする。衝突が起こるキーの組合せはどれか。ASCIIコードでは,昇順に連続した2進数が,アルファベット順にコードとして割り当てられている。

image.png

<<ASCII>>
image.png

a 97
b 98
c 99
d 100 ->1の位の数は1です。

i 105
r 114
l 108
x 120

dとxが衝突ですね。

でも、これは本当ですか?
1の位の数は1のは結構多いですね、衝突がいっぱいがあるでしょう。

たぶん、質問は、下記の意味でしょうね。
間隔が10の2つアルファベットが衝突になりますね。

例えば
a ⇔ k,u
b ⇔ l,v
c ⇔ m,w
d ⇔ n,x
...

データキー ハッシュ
a 1
b 2
c 3
d 4
e 5
f 6
g 7
h 8
i 9
j 10
k 1
l 2
m 3
n 4
o 5
p 6
q 7
r 8
s 9
t 10
u 1
v 2
w 3
x 4
y 5
z 6

参照:
https://www.ap-siken.com/kakomon/27_aki/q5.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?