KH of the data structure [Chapter 7] --> Multiple-choice questions (2)

Seven. Find multiple choice questions

(1) When performing sequential search on a table of n elements, if the probability of finding each element is the same, the average search length is (C).
A. (n-1)/2 B. n/2 C. (n+1)/2 D. n

Explanation: The total number of searches N=1+2+3+…+n=n(n+1)/2, then the average search length is N/n=(n+1)/2.


(2) The storage mode and element arrangement requirement of the table suitable for binary search is (D).
A. Linked storage, the elements are out of order B. Linked storage, the elements are ordered
C. Sequential storage, the elements are out of order D. Sequential storage, ordered elements

Explanation: The binary search requires that the linear table must adopt a sequential storage structure, and the elements in the table are arranged in order by keywords.


(3) If a linear table is required to be able to search quickly and adapt to dynamic changes, it is best to use the (C) search method.
A. Search in order B. Find it in half
C. Block search D. Hash lookup

Explanation: The advantage of block search is: when inserting and deleting data elements in the table, as long as the block corresponding to the element is found, the insertion and deletion operations can be performed in the block. Since the block is disordered, it is easier to insert and delete without a lot of movement. If the linear table needs to be searched quickly and frequently changes dynamically, block search can be used.


(4) Find the ordered list in half (4, 6, 10, 12, 20, 30, 50, 70, 88, 100). If the element 58 in the table is searched, it will be compared with (A) in the table in turn, and the search result is a failure.
A. 20, 70, 30, 50 B. 30,88,70,50
C. 20,50 D. 30, 88, 50

Explanation: There are a total of 10 elements in the table, the first time (1+10)/2=5, compared with the fifth element 20, 58 is greater than 20, and then (6+10)/2=8, Compare with the eighth element 70, and then compare with 30, 50 in turn, the final search fails.


(5) Perform a binary search on an ordered list of 22 records. When the search fails, at least (B) keywords must be compared.
A. 3 B. 4 C. 5 D. 6

Explanation: For an ordered list of 22 records, the depth of the decision tree of the binary search is log 2 22 + 1=5, and the decision tree is not a full binary tree, that is, when the search fails, the comparison is at most 5 times and at least 4 times.


(6) Time performance of binary search and binary sort tree (C).
A. Same B. Completely different
C. Sometimes different D. All orders of magnitude are O(log 2 n)


(7) The binary sorting tree is constructed with the following sequences, which is different from the results constructed with the other three sequences (C).
A. (100, 80, 90, 60, 120, 110, 130)
B. (100, 120, 110, 130, 80, 60, 90)
C. (100, 60, 80, 90, 120, 110, 130)
D. (100, 80, 60, 90, 120, 130, 110)

Explanation: The four options of A, B, C, and D construct a binary sort tree with 100 as the root. It is easy to know that the first keyword in the three sequences of A, B, and D is 80, which is the left of 100. The child is 80, and the left child of 100 in the C option is 60, so choose C.


(8) After inserting a node into the balanced binary tree, the imbalance is caused. Set the lowest imbalance node as A, and it is known that the balance factor of the left child of A is 0 and the balance factor of the right child is 1. (C) Type adjustment to make it balanced.
A. LL B. LR C. RL D. RR


(9) The following statement about m-order B-trees is wrong (== D ==).
A. The root node has at most m subtrees
B. All leaves are on the same level
C. Non-leaf nodes have at least m/2 (m is an even number) or m/2+1 (m is an odd number) subtrees
D. The data in the root node is ordered


(10) In the following description of B- and B+ trees, what is incorrect is ( C).
A. B-tree and B+ tree are both balanced polytrees. Both B-tree and B+ tree can be used for file index structure
C. Both B-tree and B+tree can effectively support sequential retrieval D. Both B-tree and B+ tree can effectively support random search


(11) The m-order B-tree is a (B).
A. m-fork sort tree B. m fork balanced sorting tree
C. m-1 fork balanced sort tree D. m+1 fork balanced sort tree


(12) The following statement about hash lookup is correct (C).
A. The more complex the hash function is constructed, the better, because it has good randomness and low conflict
. Divide and leave remainder method is the best of all hash functions
C. There is no particularly good or bad hash function, it depends on the situation
D. The average lookup length of the hash table is sometimes also related to the total number of records


(13) The following statement about hash lookup is incorrect (A).
A. When the chain address method is used to handle conflicts, the time to find an element is the same
B. When the chain address method is used to handle conflicts, if the insertion rule is always at the beginning of the chain, the time to insert any element is the same.
C. Use the chain address method to handle conflicts without causing secondary aggregation
. D. Use chain address method to handle conflicts, suitable for situations where the table length is uncertain

Explanation: In a singly linked list composed of synonyms, it takes different time to find different elements in the singly linked list.


(14) Suppose the length of the hash table is 14, the hash function is H(key)=key%11, the keywords of the existing data in the table are 15, 38, 61, and 84 in total. Now the keywords are The element 49 is added to the table, and the conflict is resolved by the secondary detection method, and the position is (D).
A. 8 B. 3 C. 5 D. 9

Explanation of the second detection method:
space-time tunnel

1 5 6 4
6
5
9

Explanation: Keyword 15 is placed in position 4, keyword 38 is placed in position 5, keyword 61 is placed in position 6, keyword 84 is placed in position 7, and keyword 49 is added. The calculated address is 5, conflict, use two The second detection method resolves the conflict and the new address is 6 but still conflicts, and then the second detection method is used to resolve the conflict, and the new address is 4, and the conflict is still used. Conflict, that is, put keyword 49 in position 9.


(15) The linear detection method is used to deal with conflicts, and multiple locations may be detected. If the search is successful, the keywords (A) at these locations are detected.
A. Not necessarily all synonyms B. Must be synonyms
C. Must not be synonymous D. All the same

Explanation: The detected keywords may have been placed in this position in the process of dealing with other keyword conflicts.


Guess you like

Origin blog.csdn.net/Touale/article/details/112710939