根据题目给出的散列函数,插入元素7、4、5、3、6、2、8、9依次插入散列表的存储结构如下:
1.插入元素7,H(7) = (7^2 + 2) mod 9 = 49 + 2 mod 9 = 51 mod 9 = 6,将7插入地址为6的链表中,存储结构如下:
[0] [1] [2] [3] [4] [5] [6] [7] [8]
[ ] [ ] [ ] [ ] [ ] [ ] -> 7 [ ] [ ]
2.插入元素4,H(4) = (4^2 + 2) mod 9 = 16 + 2 mod 9 = 18 mod 9 = 0,将4插入地址为0的链表中,存储结构如下:
[0] [1] [2] [3] [4] [5] [6] [7] [8]
->4 [ ] [ ] [ ] [ ] [ ] -> 7 [ ] [ ]
3.插入元素5,H(5) = (5^2 + 2) mod 9 = 25 + 2 mod 9 = 27 mod 9 = 0,将5插入地址为0的链表中,存储结构如下:
[0] [1] [2] [3] [4] [5] [6] [7] [8]
->5 ->4 [ ] [ ] [ ] [ ] -> 7 [ ] [ ]