看板 Grad-ProbAsk 關於我們 聯絡資訊
Q1.Suppose we implement a hash with number of buckets=100, denoted as B[0], B[2], B[99]. Let the hash function be h(i) = (i^2 + 1) % 100 . When two or more data are hashed into the same bucket, we use a singly-linked list to store these numbers in the bucket (no probing or rehashing). Let the number of data in bucket 'k' be denoted as "|B[k]|". If we insert in integral data from 1 to 1000 into the hash, which of the following is correct? (A) |B(2)|=10 (B) |B(3)|=0 (C) |B(26)|=100 (D) |B(15)|=15 (D) |B(37)|=40 知道題目在問什麼 但是不知道要怎樣去算出|B[k]| Q2.Use the double-ended queue(dequeue) to input:1,2,3,4,5,6 and 7 sequentially. In the following,what are the impossible outputs? (a)5174236 (b)1234567 (c)2143756 (d)7615243 (e)4213765 這題應該是怎麼選呢 沒有頭緒 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.124.60.24
aerystyle:第一題在問當我們輸入1-1000後,各個bucket內有幾個個數 02/07 19:31
aerystyle:第二題再問當我們把1-7輸入double-ended priority queue 02/07 19:33
aerystyle:最後答案會輸出什麼? 02/07 19:34
chencccc:再問一下 第一題是卡在要怎樣算出|B[k]| 因為hash是取 02/07 20:35
chencccc:平方+1 mod100 這有什麼方法可以算出來嗎 02/07 20:36
charliejack:Q2: Double Ended 就說他可以輸出最大 也可以輸出最 02/08 00:35
charliejack:小 所以 可能只有 1 和 7先開頭 其他可以刪掉 02/08 00:36
charliejack:(B)你全部都輸出Min 答案就是1234567 02/08 00:36
charliejack:(d)大大小大小大大 輸出式 即是答案 02/08 00:37
charliejack:第一題 我只能化簡到 你必須檢查 1~99的值..... 02/08 00:40
charliejack:因為百位數 舉個例子 978^2 = 978*(900+78) = ....... 02/08 00:42
charliejack:上面有點寫多了 978 = (a+b)^2 = a^2+2ab+b^2 02/08 00:43
charliejack:a = 900 b = 78, 因為百位數有兩個0 %之後=0 02/08 00:44
charliejack:所以 B[5] 裡面有2 還有 102 202 302 402....902 02/08 00:46
chencccc:謝謝~ Q1那題應該是可輸入邊輸出 所以答案是a 02/08 01:17
charliejack:如果可以邊輸入邊輸出 答案是 BCD吧@@? A是如何做的? 02/08 09:36
charliejack:輸出到4的話 就會發生問題呀~ 如果我有錯請糾正我@@~ 02/08 09:36
chencccc:題目是問impossible 所以答案A 就是A做不出來 02/08 20:22
xygod:請問Q1答案有幾個?我怎麼覺得bc都對 02/08 22:47
annheilong:B是要不行的喔 所以應該是AE 02/09 00:19
chencccc:Q1我這邊答案是BCE 02/09 09:46
chencccc:Q2之e 可以put1 左put2 右put3 左put4 全左pop put5 02/09 09:48
chencccc:左put6 左put7 全左pop 02/09 09:49
sneak: 最後答案會輸出什麼? https://daxiv.com 09/11 14:13