Algorithms and Data Structures [30 Days] Training Camp - Detailed Explanation to Find Chapter Data Structures (C Language Version 2nd Edition) After-Class Exercises Answers (20)

1. multiple choice

(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 ( ).

A. (n-1)/2
B . n/2
C. (n+1)/2
D . n

Answer: C
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 method and element arrangement requirements of the table suitable for split-half lookup are ( ).
A. Linked storage, unordered elements
B. Linked storage, elements are ordered
C. Stored in order, the elements are unordered
D. Sequential storage, elements are ordered

Answer: D

Explanation: The halved 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࿰

Guess you like

Origin blog.csdn.net/weixin_47723732/article/details/127468559