[理工] [資結] hash&queue
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
→
02/07 19:31, , 1F
02/07 19:31, 1F
→
02/07 19:33, , 2F
02/07 19:33, 2F
→
02/07 19:34, , 3F
02/07 19:34, 3F
→
02/07 20:35, , 4F
02/07 20:35, 4F
→
02/07 20:36, , 5F
02/07 20:36, 5F
推
02/08 00:35, , 6F
02/08 00:35, 6F
→
02/08 00:36, , 7F
02/08 00:36, 7F
→
02/08 00:36, , 8F
02/08 00:36, 8F
→
02/08 00:37, , 9F
02/08 00:37, 9F
推
02/08 00:40, , 10F
02/08 00:40, 10F
→
02/08 00:42, , 11F
02/08 00:42, 11F
→
02/08 00:43, , 12F
02/08 00:43, 12F
→
02/08 00:44, , 13F
02/08 00:44, 13F
→
02/08 00:46, , 14F
02/08 00:46, 14F
→
02/08 01:17, , 15F
02/08 01:17, 15F
推
02/08 09:36, , 16F
02/08 09:36, 16F
→
02/08 09:36, , 17F
02/08 09:36, 17F
→
02/08 20:22, , 18F
02/08 20:22, 18F
推
02/08 22:47, , 19F
02/08 22:47, 19F
推
02/09 00:19, , 20F
02/09 00:19, 20F
→
02/09 09:46, , 21F
02/09 09:46, 21F
→
02/09 09:48, , 22F
02/09 09:48, 22F
→
02/09 09:49, , 23F
02/09 09:49, 23F
→
09/11 14:13, , 24F
09/11 14:13, 24F