[理工] [資結]-成大100-電機

看板Grad-ProbAsk作者 (I'dont kown)時間12年前 (2012/01/31 12:11), 編輯推噓1(106)
留言7則, 2人參與, 最新討論串1/1
http://0rz.tw/MInEZ 想問一下Hash table問題 9.Given a hash table of 11 buckets , labbled from 0 to 10. Each bucket can hold one key. The hash function h(key) = key % 11.Chaining is used in the hash scheme.Now,Supose the hash is initially empty and then the numbers "3,41,15,36,74,58,91,45,48,64"are hashed sequentially into the hash table. (2)What are the average comparisons if each number of the sequence is looked up once? 請問這題的average comparison是要比較甚麼? (3)Hashing 的worst case 是O(n)嗎? (4)要怎樣才能使Hashing達到O(logn)? 對Hashing不是很了解Orz 麻煩請高手解答了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 175.98.50.200

01/31 13:09, , 1F
3 所有都collision 4 用binary tree
01/31 13:09, 1F

01/31 13:11, , 2F
喔 AVL或紅黑
01/31 13:11, 2F

01/31 14:05, , 3F
2是指全部在裡面後各找一次平均要比較次數?
01/31 14:05, 3F

01/31 14:55, , 4F
請問(2)是帶入hash function,如遇一次collision就表示
01/31 14:55, 4F

01/31 14:55, , 5F
比較一次嗎?
01/31 14:55, 5F

01/31 16:53, , 6F
compare就是比對是否為輸入的key吧
01/31 16:53, 6F

01/31 19:06, , 7F
謝謝on大
01/31 19:06, 7F
文章代碼(AID): #1F9se7rT (Grad-ProbAsk)