Data Structures and Algorithms -Chapter9- Find - Exercises

Multiple Choice

1. Sequential search method is suitable for the storage structure () linear form.
A. B. Hash storage Sequential storage or storage link C. Compressed storage D. Index Storage

2. When the linear table binary search, the table must be Linear requirements ().
A. In order stored
B. A link stored
C. Stored in a sequential and orderly sorted by keywords node
D. Stored in a link and node access key sort order

3. When the sequential search method to find the length n of the linear table, each element of the average length ().
A. N B. n / 2 C. (N + l) / 2 D. (N- 1) / 2

4. When using the binary search method to find the length n of the linear table, each element of the average length ().
AO (n2) B. O (nlog2n) C. O (n) D. O (log2n)

5. There is an ordered list {} 1,3,9,12,32,41,45,62,75,77,82,95,100, when the value of the binary search node 82, () after comparisons Find success.
A. 1 B. 2 C. 4 D. 8

6. disposed hash table length m = 14, the hash function H (key) two key% 11. Table has four nodes:
addr (15) = addr. 4 (38 is) = addr. 5 (61 is) = addr. 6 (84) = remainder address is empty. 7,
such as re-hashed with a secondary conflict detection, key word address of the node 49 is ().
A. 8 B. 3 C. 5 D. 9

7. A length of a sorted list 12, according to the binary search table lookup, to find the probability of success required in the case of other inner elements of the average length ().
A. 35/12 B. 37/12 C. 39/12 D. 43/12

8. When using block search, if the total linear table of 625 elements, each element of the probability to find the same, assuming sequential lookup to determine a block where the nodes, each should be sub optimal () nodes.
A. 10 B. 25 C. 6 D. 625
9. If both a faster linear table lookup, but also adapt to the dynamic changing requirements () method may be used to find.
A. Block B. C. order Half D. Hash

10. The element 100 is provided, with a binary search to find the maximum number of comparisons is ().
A. 25 B. 50 C. 10 D. 7 (decision tree depth = foor (log2n) +1)

11. When the element 100 is provided, with a binary search to find the minimum number of comparisons is ().
A. 7 B. 4 C. 2 D. 1

12. A common hash function has properties, i.e. it should function value for each value in () whichever value range.
A. equal probability of B. The maximum probability C. The minimum probability D. The average probability

13. Provided hash address space 0 ... m-1, k is a key, the hash function takes as H (k) = k% p , in order to reduce the frequency of collisions occur, generally taken as p ().
M is smaller than the maximum odd A. B. Maximum even number smaller than m
C. The maximum prime number smaller than m D. The maximum number smaller than m co

14. A table stored in the order of 90,000 elements have been ascending order by key value, assuming that the probability to find for each element is the same, and the key value of each element are different, by sequential search when searching method, comparison of the average number of about (C), about the maximum number of comparisons (D).
A. 25000 B. 30000 C. 45000 D. 90000

Fill in the blank

1. In various methods lookup, to find the average length and the node number n independent search method is a method (hash table lookup).

2. Binary search is limited to the storage structure (ordered list), and a (sequential memory).

3. In a block search method, first lookup (index table), and then find the appropriate (block).

4. Length table 255, using block searching method, the optimum length of each block is (15).

5. Assuming a linear list ordered A [l. . Binary search performed 20] on a comparison to find the number of nodes is successful (1), the second search is successful comparison of the number of nodes (2), comparing the number of nodes in the three lookup is successful (4), four comparator lookups nodes with success (8), the comparator five nodes with successful lookup (5), the average length of (3.7).

6. For length n linear table, if the sequential search, the time complexity (O (n)); if the lookup using the binary method, the time complexity is ((log2n)); the use of a block search (assuming total length and number of blocks are close to each), the time complexity (O (n1 / 2)).

7. In the hash memory, the larger the value of the filling factor а, the (probably larger conflict, the more the number of keywords compared lookup); а smaller value, the (probably less conflict, Compare the number of times a keyword, the less time to find).

8. The basic idea is to store hash lookup by address (keyword) decision data.

9. Hash table lookup efficiency dependent on the chosen (hash function) (Method of conflict), and (filling factor hash table).

10. binary search is unsuccessful, the emergence of (low> high), the program terminates.

Short answer

1. Provided hash table is 13, the hash function H (k) = k% 13, given keyword sequence: 19,14,23,01,68,20,84,27,55,11, 10,79}, the hash table to resolve the conflict when the drawn linear detection method and a chain composed of address method, and the like, and determining the probability that these two methods when the average length to find success.

2. Assuming that there are n ones, and they have the same hash function value, linear method to detect these keywords into n hash address to detect how many times do? (N + 1) * n / 2

3. Ordered table set {a, b, c, d, e, f, g, h, i}, respectively Draw given value e k and the binary search process is performed.

4. When the search is successful ASL length shown in Table 10 is an ordered binary decision tree lookup, and the like and for its introduction.

发布了393 篇原创文章 · 获赞 651 · 访问量 5万+

Guess you like

Origin blog.csdn.net/weixin_43896318/article/details/104092868