ID
int64
1
1.96k
Split
stringclasses
1 value
Domain
stringclasses
4 values
SubDomain
stringclasses
24 values
Format
stringclasses
1 value
Tag
stringclasses
2 values
Language
stringclasses
1 value
Question
stringlengths
15
717
A
stringlengths
1
292
B
stringlengths
1
232
C
stringlengths
1
217
D
stringlengths
1
192
Answer
stringclasses
4 values
Explanation
stringlengths
21
1.43k
301
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Two lists composed of n data elements: one in ascending order and the other unordered, use the sequential search algorithm. For the ordered list, start searching from the beginning and stop when the current element is no longer less than the element to be searched, concluding that the search is unsuccessful. Given that the probability of searching for any element is the same, the probability of a successful search in both types of lists is ( ).
The average time for the latter is smaller.
The average time is the same for both.
The average time of the former is less.
Unable to determine
B
For sequential search, regardless of whether the linear list is ordered or unordered, the number of comparisons to successfully find the first element is 1, the number of comparisons to successfully find the second element is 2, and so on. That is, the number of comparisons for successful search of each element is only related to its position (irrelevant to whether it is ordered), hence the average time for a successful search is the same for both.
302
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Among the following statements about binary search, the correct one is ().
Tables must be ordered, they can be stored sequentially or through linked list storage.
Tables must be ordered and the data within must be of integer, real, or character type.
Tables must be ordered and arranged in ascending order only.
Tables must be ordered and can only be stored in a sequential manner.
D
Binary search locates the middle element by index, so sequential storage should be used, and the prerequisite for binary search is that the lookup table must be sorted, although it does not specify whether the order is from largest to smallest or from smallest to largest.
303
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
When searching for data on a sequentially stored ordered linear list, both binary search and sequential search can be used, but the former is () than the latter.
Inevitably fast
Depending on whether the table is increasing or decreasing
In most cases, it is necessary to be fast.
Inevitably not fast
C
The speed of binary search is generally evident in most cases, where it is faster than sequential search. However, for certain special cases, sequential search may be quicker than binary search. For example, when searching for the first element in an ordered list with 1000 elements, sequential search only requires 1 comparison, while binary search requires nearly 10 comparisons.
304
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
The Time Performance of Half Search and Binary Sort Trees()
identical
Sometimes not the same
Completely different
Incomparable
B
The performance analysis of binary search can be measured using a binary decision tree, with both the average search length and the maximum search length being O(log2n); the search performance of a binary search tree is related to the order of data input. In the best case, the average search length is the same as that of binary search, but in the worst case, when a single branch tree is formed, the search length is O(n).
305
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Perform a binary search on an ordered list A[1, 2, ..., 11] with 11 elements, using the formula [(low + high) / 2], to find the element A[11]. The sequence of indices of the elements compared is ().
6, 8, 10, 11
6, 9, 10, 11
6, 7, 9, 11
6, 8, 9, 11
B
Based on the idea of the binary search algorithm, the first mid calculation is mid=[(1+11)/2]=6, the second mid calculation is mid=[[(6+1)+11)/2]=9, the third mid calculation is mid=[[(9+1)+11)/2]=10, and the fourth mid calculation is mid=11.
306
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Given the ordered list (13,18,24,35,47,50,62,83,90,115,134), the number of comparisons made to successfully find the element with the value of 90 using binary search is ().
1
2
4
6
B
Initially, low points to 13, high points to 134, and mid points to 50. During the first comparison, 90 > 50, so low is moved to point to 62, high remains pointing to 134, and mid moves to point to 90. On the second comparison, 90 is found.
307
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
For a binary search on an ordered list of length n, the height of the decision tree is ().
[log2(n+1)]
[log(n+1)]-1
[log2n]
[log2n] - 1
A
For a decision tree with n nodes, if the total number of nodes n = 2^h - 1, then h = [log2(n + 1)].
308
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
To improve search efficiency, for an ordered sequential list with 65,025 elements, constructing an index sequential structure results in a maximum of ( ) key comparisons required to find an existing element in the best-case scenario.
10
14
16
21
C
To achieve the highest search efficiency, the size of each index block should be √65025 = 255. By creating an index for each block, the number of index entries in the index table is 255. If binary search is used for both the index entries and within the index blocks, the highest search efficiency is [log2(255+1)] + [log2(255+1)] = 16.
309
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
For a binary search tree, the following statement is correct: ( )
A binary search tree is a dynamic tree structure where a new node is inserted when a search fails, causing the tree to be restructured through splits and recombination.
Performing a level-order traversal on a binary search tree yields a sorted sequence.
Construct a binary search tree using the method of point-by-point insertion. If the keys are inserted in order, the maximum depth of the binary search tree is.
In a binary search tree, the number of comparisons of keys does not exceed the logarithm (base 2) of the number of nodes.
C
Inserting a new node into a binary sort tree does not cause the tree to split or combine. An inorder traversal of a binary sort tree yields a sorted sequence. When the keys inserted are in order, the binary sort tree will form a long chain, at which point the depth is at its maximum. In this case, when performing a search, it may be necessary to compare the keys of each node, exceeding half of the total number of nodes.
310
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Assuming a binary search tree is composed of integer keys ranging from 1 to 1000, the sequence of keys that could not possibly represent the search path for a node with the key 363 in the binary search tree is ().
2, 252, 401, 398,330, 344, 397, 363
2924, 220, 911, 244, 898, 258, 362, 363
925,202,911,240, 912, 245,363
2,399,387.219, 266,382.381, 278,363
C
When searching in a binary search tree, first compare with the value of the root node. If they are the same, the search ends; otherwise, continue searching downward along the left or right subtree based on the comparison result. According to the definition of a binary search tree, the values of nodes in the left subtree are ≤ the value of the root node ≤ the values of nodes in the right subtree. In sequence C, after comparing the key 911, one should turn to its left subtree to compare with 240. There should not be any value greater than 911 in the left subtree, but 240 has a right child node with the value of 912, so it cannot be the correct sequence.
311
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Construct binary search trees using the following sequences, which differ from the results constructed with the other three sequences are ().
(100, 80, 90, 60, 120, 110, 130)
(100,120,110,130,80,60,90)
(100, 60, 80, 90, 120, 110, 130)
(100, 80, 60, 90, 120, 130, 110)
C
Following the construction method of a binary sort tree, it is not difficult to obtain that the construction results of the sequences A, B, and D are the same.
312
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Among the following statements about red-black trees, the incorrect one is ().
A red-black tree with n nodes has a height of at most 2log2(n+1).
If a node is red, then both its parent node and child nodes are black.
All paths from a node to its descendant nodes contain the same number of black nodes.
The search efficiency of a red-black tree is generally superior to that of an AVL tree with the same number of nodes.
D
Options A, B, and C are all properties of red-black trees. AVL is a height-balanced binary search tree, while red-black trees are moderately balanced binary search trees, which also indicates that AVL trees often have superior search efficiency.
313
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Among the following descriptions of red-black trees and AVL trees, the incorrect one is ().
Both are self-balancing binary trees.
Both have the same time complexity for search, insertion, and deletion operations.
The insertion and deletion processes of a red-black tree involve at most 2 rotations.
The height difference between the left and right subtrees of any node in a red-black tree does not exceed twice.
C
A self-balancing binary search tree is one that automatically adjusts during insertions and deletions to maintain its defined balance. Both red-black trees and AVL trees are types of self-balancing binary search trees, A is correct. In a red-black tree, when deleting a node, case 1 may transition to case 2, 3, or 4, and case 2 may become case 3, which could result in more than 2 rotations, C is incorrect.
314
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Before performing an insertion operation in a B-tree of order m, if the number of keys in a node equals (), it must be split into two nodes. Before performing a deletion operation in a B-tree of order m, if the number of keys in a node equals (the minimum number of keys that node should contain), it may need to be merged with its left or right sibling node.
m, [m/2] - 2
m-1, [m/2]-1
m + 1, ⌊m/2⌋
m/2, [m/2] + 1
B
Since each node in a B-tree can contain at most m-1 keys, it should be split when the number of keys exceeds m-1. Additionally, each node must contain at least [m/2]-1 keys, so if the number of keys falls below [m/2]-1, it should be merged with other nodes.
315
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
An m-ary B-tree with n non-leaf nodes contains at least () keys.
n(m + 1)
n
n([m/2]1)
(n-1)(⌊m/2⌋-1)+ 1
D
Except for the root node, each non-leaf node in an m-order B-tree has at least [m/2]-1 keys, and the root node has at least one key, so the minimum total number of keys contained = (n-1)([m/2]-1)+1.
316
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Among the following statements about B-trees and B+-trees, the incorrect one is ().
B-trees and B+-trees both effectively support sequential search.
B-trees and B+-trees both effectively support random search.
B-trees and B+-trees are both balanced multiway trees.
B-trees and B+ trees can both be used for file indexing structures.
A
The differences between B-trees and B+-trees are mainly reflected in: ① The number of node keys and subtrees; ② B+-tree non-leaf nodes serve only as indexes; ③ B-tree leaf node keys are unique and do not duplicate keys in other nodes; ④ B+-trees support both sequential and random searches, while B-trees only support random searches. Since all leaf nodes in a B+-tree contain all the key information and are linked in ascending order by key, sequential searches can be performed, which is not supported by B-trees.
317
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Hash search is generally suitable for situations where ( ).
Lookup table is a linked list.
The lookup table is an ordered table.
The set of keywords is much larger than the set of addresses.
There is a correspondence between the set of keywords and the set of addresses.
D
When there is a correspondence between the set of keywords and the set of addresses, this relationship is represented by a hash function. In this way, searching is conducted by computing the hash function rather than by comparison.
318
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Among the following statements about hash tables, the correct one is () Ⅰ. If the load factor of the hash table is <1, collisions can be avoided Ⅱ. No comparison of keys is needed in hash search Ⅲ. The average search length for a successful search in a list is related to the length of the table Ⅳ. If removing an element from the hash table, the element cannot simply be deleted
Ⅰ,Ⅳ
Ⅱ,Ⅲ
D
Conflicts (collisions) are inevitable and are not related to the load factor; therefore, methods for handling conflicts need to be designed, Ⅰ incorrect. The idea of hash searching is to compute the hash address for searching and then compare the key to determine if the search is successful, Ⅱ incorrect. The average search length for a successful hash search is related to the load factor and is not related to the length of the table, Ⅲ incorrect. In the case of open addressing, one cannot arbitrarily delete an element from the hash table, as it may lead to the interruption of the search path (hence the common practice is to mark the spot for deletion instead of directly deleting it), Ⅳ correct.
319
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
Assuming there are K keywords that are synonyms, if the linear probing method is used to insert these K keywords into a hash table, at least () probes must be conducted.
K-1
K
K+ 1
K(K + 1)/2
D
During the process of sequentially inserting K keywords, only the first one will not encounter a collision, thus the number of probes is (1+2+3+...+K)=K(K+1)/2, which means the correct answer is D.
320
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
In hash searching using open addressing to resolve collisions, the primary cause of clustering is ().
Too many data elements
The load factor is too high.
Improper selection of hash function
Inappropriate choice of method for conflict resolution
D
Clustering is the phenomenon where elements with different keys compete for the same hash address due to the improper selection of collision resolution methods. When using linear probing, it is easy to trigger clustering.
321
Test
Data Structure and Algorithm
Searching
Multiple-choice
Reasoning
English
When hashing 10 elements into a hash table with 100,000 cells, it is () to generate collisions.
There will definitely be
It definitely won't
may still
Uncertain
C
Due to the selection of the hash function, it is still possible to generate address collisions, which cannot be absolutely avoided.
322
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the stability of a sorting algorithm defined?
All sorting algorithms are stable.
An algorithm is considered stable if elements with the same key maintain their relative order.
An algorithm with fast execution speed is stable.
An algorithm that occupies less space is stable.
B
null
323
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What are the evaluation criteria for sorting algorithms?
Only time complexity
Only the space complexity
Time complexity and space complexity
Time complexity, space complexity, and stability
D
null
324
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the main difference between internal sorting and external sorting?
Internal sorting is performed in memory, while external sorting is carried out on a hard drive.
Internal sorting is only suitable for small datasets, while external sorting is applicable to large datasets.
Internal sorting has a high time complexity, while external sorting has a low time complexity.
Internal sorting has high space complexity, while external sorting has low space complexity.
A
null
325
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the basic idea of direct insertion sort?
Select the smallest element each time and place it at the end of the sorted sequence.
Sort by swapping adjacent elements.
Insert each record to be sorted into the already sorted subsequence.
Merge all elements into an ordered sequence once.
C
null
326
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
For which types of linear lists is the direct insertion sort suitable?
Applicable only to linear lists with sequential storage
Applicable only to linear lists with linked storage.
Applicable to sequential storage and linked storage of linear lists.
Not applicable to any linear list.
C
null
327
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the role of binary search in binary insertion sort?
Determine the insertion position and reduce the number of key comparisons.
Accelerate the speed of finding the minimum element.
Reduce the number of element movements
Determine the direction of sorting
A
null
328
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the time complexity of binary insertion sort?
O(n^2)
O(n)
O(nlogn)
O(logn)
A
null
329
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the basic idea of Shell sort?
Use an incremental sequence to segment the table and perform partial sorting.
Compare and swap adjacent elements one by one.
Select the smallest element and place it at the end of the sorted sequence.
Merge all elements into an ordered sequence once.
A
null
330
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the role of the increment in Shell sort?
Partition the table into "special" subtables for local sorting.
Control the direction of sorting
Determining the speed of sorting
The element used as a benchmark for comparison
A
null
331
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the time complexity of Shell sort?
O(n^2)
O(nlogn)
O(n^1.3)
O(n)
C
null
332
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the basic operation of bubble sort?
Compare and swap adjacent elements one by one.
Use the increment sequence to segment the table for sorting.
Select the smallest element and place it at the end of the sorted sequence.
Merge all elements into one ordered sequence once.
A
null
333
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the optimization strategy in bubble sort?
Swap the order of adjacent elements
Use binary search to determine the swap position.
Terminate the sorting process early when a round of comparison occurs without any swaps.
Optimize the comparison process using sentinel elements.
C
null
334
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the time complexity of bubble sort?
O(nlogn)
O(n^1.3)
O(n)
O(n^2)
D
null
335
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the stability of the bubble sort algorithm?
Unstable
Dependent on the input data
Unable to determine
stable
D
null
336
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the basic idea of quicksort?
Divide the table to be sorted into two parts through a single pass of sorting.
Use incremental sequence to segment the table for sorting.
Select the smallest element and place it at the end of the sorted sequence.
Merge all elements into an ordered sequence once.
A
null
337
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What are the performance characteristics of quicksort?
Optimal Internal Sorting Algorithm
Best suited for sorting small-scale data.
Additional storage space is required.
Applicable to linked storage structure
A
null
338
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the stability of the quicksort algorithm?
Unstable
Dependent on the input data
Unable to determine
stable
A
null
339
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What are the basic steps of simple selection sort?
Select the element with the smallest key from the elements to be sorted and swap it with the first element.
Insert elements into the sorted sequence in order.
Compare adjacent elements in sequence and swap them.
Use the divide and conquer method to sort elements.
A
null
340
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What is the time complexity of simple selection sort?
O(n)
O(n^2)
O(nlogn)
O(n^1.3)
B
null
341
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the stability of simple selection sort?
stable
Unstable
Depends on the specific implementation
Unable to determine
B
null
342
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
For which storage structures is simple selection sort suitable?
Applicable only to sequential storage
Applicable only to linked storage
Applicable to sequential storage and linked storage.
Not applicable to any storage structure
C
null
343
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
What are the basic steps of heap sort?
Construct a max heap, then swap the top element with the bottom element of the heap.
Perform down-heap (percolate down) for each non-leaf node.
Sort only the top element of the heap.
Select the smallest element to place at the top of the heap each time.
A
null
344
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the stability of heap sort?
stable
Unstable
Depends on the specific implementation
Unable to determine
B
null
345
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
How is the small root heap defined in heap sorting?
A complete binary tree where each node is less than its children.
A sequentially stored complete binary tree
A complete binary tree where each node is greater than its children.
A tree where the value of any node is equal to the values of its child nodes.
A
null
346
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Knowledge
English
The sorting method that is more related to the original state of the sequence is the ( ) sort.
Insert
Selection
Bubble
cardinality
C
null
347
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sorting methods, the one that is not an internal sorting method is ().
Insertion Sort
Selection Sort
Topological Sorting
Bubble Sort
C
Topological sorting is the process of arranging all the nodes in a directed graph into a linear sequence. Although it is also performed in memory, it does not fall under the category of internal sorting mentioned here, nor does it meet the definition of sorting previously described.
348
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The following statement about sorting is correct ( )
Stable sorting algorithms are superior to unstable sorting algorithms.
Using different sorting methods on the same linear list may yield different sorting results.
Sorting methods are implemented on sequential lists and cannot be implemented on linked lists.
The sorting methods implemented on sequential lists can also be implemented on linked lists.
B
The stability of an algorithm is unrelated to its quality; option A is excluded. Sorting can also be performed using a key table, but some sorting algorithms become inapplicable because locating elements can only be done by sequentially searching through the list, such as with binary insertion sort.
349
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
For sorting any 7 keys based on comparison, at least ( ) pairwise comparisons between keys must be performed.
13
14
15
6
A
For sorting any sequence based on comparison, the minimum number of comparisons should consider the worst-case scenario. The number of comparisons required to sort any number of keys is at least [log(n!)]. Substituting n=7 into the formula, the answer is 13.
350
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The data series {8,10,13,4,6,7,22,2,3) can only be the result of two sorts of ().
Simple Selection Sort
Bubble Sort
Direct Insertion Sort
Heap Sort
C
After two passes of bubble sort and selection sort, there should be two largest (or smallest) elements placed in their final positions; after two passes of insertion sort, the first three elements should be locally sorted. It can only be quicksort.
351
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
In the following algorithms, the () algorithm may exhibit the following situation: before the last iteration begins, none of the elements are in their final positions.
Timsort
Bubble Sort
Direct Insertion Sort
Quick Sort
C
In direct insertion sort, if the last element of the sequence to be sorted should be inserted into the first position of the list, then all elements in the preceding sorted subsequence are not in their final positions.
352
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Shell sort belongs to ().
Insertion Sort
Exchange Sort
Selection Sort
Merge Sort
A
Shell sort is an improved version of the direct insertion sort algorithm and is essentially still a type of insertion sort.
353
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
If the sequence (15,9,7,8,20,-1,4) becomes {9,15,7,8,20,-1,4} after one pass of sorting, then the method used is one of the following ().
Selection Sort
Quick Sort
Direct Insertion Sort
Bubble Sort
C
The first two elements are already locally sorted; it is evident that one pass of the straight insertion sort algorithm is effective. Other algorithms can then be excluded.
354
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
For the sequence {98,36,-9,0,47,23,1,8,10,7}, using Shell sort, the following sequence () is the result of one pass with an increment of 4.
{10, 7, -9, 0, 47, 23, 1, 8, 98, 36}
{-9,0,36,98,1,8,23,47,7,10}
{36, 98, 9, 0, 23, 47, 1, 8, 7, 10}
None of the above is correct.
A
An increment of 4 means that all records at a distance of 4 form a group, and then a straight insertion sort is performed within the group. Upon observation, only option A meets the requirement.
355
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The time complexity of the binary insertion sort algorithm is ().
O(n)
O(nlog₂n)
O(n^2)
O(n^3)
C
Although binary insertion sort is an improvement over straight insertion sort, it only reduces the number of comparisons, not the number of movements. The time complexity remains O(n^2).
356
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Some sorting algorithms ensure that during each pass of the sorting process, one element is placed in its final position. This is not the case with the () algorithm.
Shell sort
Heap Sort
Bubble Sort
Quick Sort
A
Since Shell sort is based on the insertion sort algorithm, it does not necessarily place an element in its final position after each sorting pass.
357
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sorting algorithms, the unstable one is ().
Bubble Sort
Direct Insertion Sort
Shell sort
Merge Sort
C
Shell sort is a complex insertion sorting method, and it is an unstable sorting algorithm.
358
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sorting algorithms, the stable ones are ().
Quick Sort
Heap sort
Direct Insertion Sort
Simple Selection Sort
C
In the three categories of sorting methods based on insertion, exchange, and selection, the simpler methods are usually stable (such as straight insertion, binary insertion, and bubble sort), but there is an exception, which is simple selection. The more complex methods are all unstable (such as Shell sort, quicksort, and heap sort).
359
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The number of element swaps is maximized when using the bubble sort method to arrange n distinct elements in ascending order under the condition of ().
Arranged in descending order
Arranged in ascending order
Elements are disordered.
Elements are fundamentally ordered.
A
Under normal circumstances, bubble sort performs at least 1 bubble operation and at most n-1 bubble operations. When the initial sequence is in reverse order, n-1 bubble operations are required, and the number of swaps needed is the highest. When the initial sequence is in order, the algorithm can be terminated after 1 bubble operation (with no swaps).
360
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
When using a certain sorting method to sort the linear list {25,84,21,47,15,27,68,35,20}, the changes in the element sequence are as follows: (1) 25,84,21,47,15,27,68,35,20 (2) 20,15,21,25,47,27,68,35,84 (3) 15,20,21,25,35,27,47,68,84 (4) 15,20,21,25,27,35,47,68,84 The sorting method used is ( ).
Selection Sort
Insertion Sort
2-way merge sort
Quick Sort
D
Selection sort determines the final position of an element after each pass, which is incorrect for insertion sort, as the first i+1 elements should be in order after the ith pass. In the second pass, {20,15} and {21,25} are in reverse order, so it is not merge sort. Quick sort places the pivot element in its final position in each pass and then divides the sequence into two sub-sequences based on it. Observing the sorting process in the question, it can be determined that it is quick sort.
361
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The key codes of a set of records are (46, 79, 56, 38, 40, 84). Using the quick sort method with the first record as the pivot, the result of one partition in ascending order is ().
(38, 40, 46, 56, 79, 84)
(40, 38, 46, 79, 56, 84)
(40, 38, 46, 56, 79, 84)
(40,38.146.84.56,79)
C
Using 46 as the pivot element, first scan backwards for elements smaller than 46 and swap them, then scan forwards for elements larger than 46 and swap 46 with those elements, resulting in {40, 46, 56, 38, 79, 84}. After that, continue repeating the backward scanning and forward scanning operations until 46 is in its final position. The answer is option C.
362
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The data sequence F={2,1,4,9,8,10,6,20} can only be the result after two passes of the following sorting algorithms: ( ).
Quick Sort
Bubble Sort
Selection Sort
Insertion Sort
A
If it were insertion sort, the first three elements should be in order, which is clearly not the case. Both bubble sort and selection sort should have two elements in their final positions (at the far left/right) after two passes, regardless of whether the sorting is from smallest to largest or largest to smallest. There are no two elements in the data sequence that meet this condition, so the only possible choice is A.
363
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
For the data sequence {8,9,10,4,5,6,20,1,2}, using bubble sort (in reverse order, requiring ascending order), the minimum number of passes required is ().
3
4
5
8
C
The process of "bubbling" from back to front is as follows: the 1st pass (1,8,9,10,4,5,6,20,2), the 2nd pass (1,2,8,9,10,4,5,6,20), the 3rd pass (1,2,4,8,9,10,5,6,20), the 4th pass (1,2,4,5,8,9,10,6,20), the 5th pass (1,2,4,5,6,8,9,10,20). After the 5th pass, the sequence is already globally ordered, hence option C is chosen. In practice, after each bubble exchange, it is possible to determine whether it will lead to new inversions. If not, the sequence is globally ordered after that pass, so a minimum of 5 passes is sufficient.
364
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
For the following four sequences, use the quick sort algorithm to sort based on the first key. The sequence with the most record movements during the first pass is ().
92, 96, 88, 42, 30, 35, 110, 100
92,96,100,110,42,35,30,88
100,96,92,35,30,110,88,42
42,30,35,92,100,96,88,110
B
Performing a quick sort on each sequence separately, the following analysis can be made (taking A as an example): Since the pivot value is 92, 35 moves to the first position, 96 moves to the sixth position, and 30 moves to the second position. Then, the pivot value is moved to the cell where 30 is located, which is the fifth position. Therefore, the number of moves in sequence A is 4. Similarly, it can be analyzed that the number of moves in sequence B is 8, in sequence C is 4, and in sequence D is 2.
365
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sequences, ( ) could be the sequence obtained after performing the first quicksort pass. Ⅰ. {68,11,18,69,23,93,73} Ⅱ. {68,11,69,23,18,93,73} Ⅲ. {93,73, 68,11,69,23,18} Ⅳ. {68,11,69,23,18,73,93}
Ⅰ,Ⅳ
Ⅱ,Ⅲ
Ⅲ,Ⅳ
C
Clearly, if sorted from smallest to largest, the final ordered sequence is {11,18,23,68,69,73,93}; if sorted from largest to smallest, the final ordered sequence is {93,73,69,68,23,18,11}. By comparison, it is evident that there are no elements in their final positions in both I and II, hence I and II are both impossible. In III, 73 and 93 are in their final positions after sorting from largest to smallest, and 73 divides the sequence into two parts: those greater than 73 and those less than 73, therefore III is possible. In IV, 73 and 93 are in their final positions after sorting from smallest to largest, and 73 also divides the sequence into parts greater than 73 and less than 73.
366
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
In the following sorting algorithms, the method that selects the record with the smallest key from the unsorted records each time and adds it to the end of the sorted records is ( ).
Simple Selection Sort
Bubble Sort
Heap Sort
Direct Insertion Sort
A
Simple Selection Sort
367
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The number of comparisons and the number of movements for the simple selection sort algorithm are respectively ().
O(n), O(log2n)
O(log2n), O(n^2)
O(n^2), O(n)
O(nlog2n), O(n)
C
The number of comparisons for simple selection sorting is O(n^2) and the number of moves is O(n)
368
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Perform heap sort on the key sequence {23,17,72,60,25,8,68,71,52}, the remaining heap after removing the two smallest keys is ( ).
{23, 72, 60, 25, 68, 71, 52}
{23, 25, 52, 60, 71, 72, 68}
{71, 25, 23, 52, 60, 72, 68}
{23, 25, 68, 52, 60, 72, 71}
D
The initial heap created by the sieve method is {8,17,2352,25,72,6871,60}. After outputting 8 and reconstructing, the heap becomes {17,25,23,52,60,72,68,71}. After outputting 17 and reconstructing, the heap becomes {23,25,68,52,60,72,71}.
369
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sorting algorithms, ( ) does not require comparison of keys.
Quick Sort
Merge Sort
Radix Sort
Heap Sort
C
Radix sort is a sorting algorithm based on the size of each digit of the key, rather than on comparisons of the keys themselves.
370
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following sorting methods, the one whose number of comparisons during the sorting process is independent of the initial state of the sequence is ().
Merge Sort
Insertion Sort
Quick Sort
Bubble Sort
A
The number of comparisons of the merge sort is independent of the initial state of the sequence.
371
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
In a 2-way merge sort, the order of magnitude of the number of merge passes is ().
O(n)
O(log₂n)
O(nlog₂n)
O(n^2)
B
For sorting N elements using k-way merge sort, the number of passes m satisfies k^m = N, thus m = [log_k N]. In this case, it is [log_2 N].
372
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The keys of the records after the first pass of 2-way merge sort are {25,50,15,35,80,85,20,40,36,70}, which include 5 sorted sublists of length 2. The result of the second pass of 2-way merge sort on this sequence is ().
15,25,35,50,80.20,85,40,70,36
15,25,35,50,20,40,80,85,36,70
15,25,50,35,80,85,20,36,40,70
15,25,35,50,80,20,36,40,70,85
B
Since a 2-way merge sort algorithm is used here, and it is the second pass of sorting, every 4 elements are merged together. The sequence can be divided into {25,50,15,35}, {80,85,20,40}, and {36,70}. After sorting them separately, we get {15,25,35,50}, {20,40,80,85}, and {36,70}. Therefore, option B is selected.
373
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
If Chinese people are sorted by their birthdays (considering only the month and day, not the year), the fastest sorting algorithm to use would be ().
Merge Sort
Shell sort
Quick Sort
Radix Sort
D
Sorting all Chinese people's birthdays, on one hand, N is very large; on the other hand, the number of sorting codes contained in the key is 2, with one sorting code having a radix of 12 and the other a radix of 31, both of which are relatively small numbers. Therefore, radix sort can be used to complete the sorting process within O(N).
374
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
To require a stable sort where the keys are real numbers, one should choose from the following sorting methods ().
Direct Insertion Sort
Selection Sort
Radix Sort
Quick Sort
A
Using the process of elimination. Since the problem requires a stable sort, options B and D are excluded. Furthermore, since radix sort cannot sort real numbers of types float and double, option C is also excluded.
375
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The sorting method below with a time complexity of O(nlog2n) and is stable is ( ).
Heap Sort
Quick Sort
Merge Sort
Direct Insertion Sort
C
Heap sort and quick sort are not stable sorting methods, while the time complexity of the direct insertion sort algorithm is O(n^2).
376
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Assuming there are n nodes in the sequence to be sorted, and the nodes in the sequence are already very close to being ordered, the time complexity for sorting them using straight insertion sort, merge sort, and quicksort should be ().
O(N), O(N), O(N)
O(N), O(Nlog₂N), O(Nlog₂N)
O(N), O(Nlog2N), O(N^2)
O(N^2), O(Nlog2N), O(N^2)
C
When the nodes in the sequence are very close to ordering, they are sorted by direct insertion sorting, merge sorting and quick sorting, and the time complexity of these algorithms is O(N), O(Nlog2N), and O(N^2), respectively
377
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
In terms of auxiliary space used by sorting algorithms, the relationship between heap sort, quick sort, and merge sort is ().
Heap sort < Quick sort < Merge sort
Heap Sort < Merge Sort < Quick Sort
Heap sort > Merge sort > Quick sort
Heap sort > Quick sort > Merge sort
A
Since the space complexity of heap sort is O(1), the space complexity of quicksort is O(n) in the worst case and O(log2n) on average, and the space complexity of merge sort is O(n), it is not difficult to conclude that the correct option is A.
378
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The sorting method whose number of passes is independent of the original state of the sequence is (). Ⅰ. Straight Insertion Sort Ⅱ. Simple Selection Sort Ⅲ. Bubble Sort Ⅳ. Radix Sort
Ⅰ,Ⅱ
Ⅰ,Ⅱ,Ⅳ
Ⅰ,Ⅱ,Ⅲ
Ⅰ,Ⅳ
B
The number of passes in exchange-based sorting is related to the initial sequence state, hence bubble sort depends on the initial sequence. Direct insertion sort: each pass inserts one element, so the fixed number of passes is n-1; simple selection sort: each pass selects the smallest (or largest) element, so the fixed number of passes is n-1; radix sort: each pass involves "distribution" and "collection," with the fixed number of passes being d.
379
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Assuming there are 375000 records stored on a disk, performing a 5-way balanced merge sort, and the memory workspace can accommodate 600 records, the number of passes required to sort all records is ().
3
4
5
6
B
The initial number of merge segments r = 375000 / 600 = 625, thus the number of merge passes S = [log_m r] = [log_5 625] = 4. The first pass merges 625 segments into 625 / 5 = 125 segments; the second pass merges 125 segments into 125 / 5 = 25 segments; the third pass merges 25 segments into 25 / 5 = 5 segments; the fourth pass merges 5 segments into 5 / 5 = 1 segment.
380
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The function of permutation-selection sort is ().
Used to generate initial merge segments for external sorting
Efficient external sorting algorithm for sorting a disk file into an ordered file.
The length of the initial merge segments generated is twice the size of the memory workspace.
Parallel processing of input/merge/output in external sorting.
A
Permutation-selection sort is a method used in external sorting to generate initial merge runs, which results in initial merge runs of unequal lengths. On average, the length of these runs is twice that of the traditional equal-length initial merge runs, thereby reducing the number of initial merge runs to nearly half of the original count. However, permutation-selection sort is not a complete external sorting algorithm for producing ordered files.
381
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
The role of the optimal merge tree in external sorting is ().
Complete m-way merge sort.
Optimization scheme for m-way merge sort
Generate initial merge segments
Similar to the function of a tournament tree
B
The role of the optimal merge tree in external sorting is to design an optimized scheme for m-way merge sort. By emulating the construction of a Huffman tree, using the length of the initial merge segments as weights, an m-ary Huffman tree with the minimum weighted path length is constructed. This can effectively reduce the number of read and write operations during the merge process, thereby accelerating the speed of external sorting.
382
Test
Data Structure and Algorithm
Sorting
Multiple-choice
Reasoning
English
Among the following descriptions of the role of input/output buffers in the external sorting process, the incorrect one is ().
Temporary store Input/Output Log
internal merge workspace
Workspace for generating initial merge segments
Transmitting messages of the user interface
D
In the external sorting process, the input/output buffer serves as the memory workspace for sorting. For instance, an m-way balanced merge requires m input buffers and 1 output buffer to hold the records participating in the merge and the records that have been merged. It can also be used as the workspace for internal sorting when generating initial merge segments. It does not have the task of conveying messages to the user interface.
539
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
Which classification of computers is based on instruction and data flow?()
Analog electronic computer and digital electronic computer
Dedicated Computers and General-Purpose Computers
Single Instruction stream, Single Data stream system (SISD), Single Instruction stream, Multiple Data stream system (SIMD)
Mainframe, large-scale computer, medium-sized computer, minicomputer, microcomputer, and microcontroller.
C
null
540
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What components make up the computer hardware system in early von Neumann machines?()
Arithmetic Logic Unit (ALU), Control Unit, Memory
Arithmetic logic unit (ALU), memory, control unit, input devices, output devices.
Program Counter, Instruction Register, Control Unit
Main memory, auxiliary memory, cache
B
null
541
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What does machine word length refer to?()
The smallest unit of time in a CPU
The bit number of Memory Address Register (MAR)
The number of bits of binary data that a computer can process in a single integer operation.
The length of the binary code stored in each storage cell in the memory
C
null
542
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What do 32-bit and 64-bit primarily refer to in computers?()
CPU clock frequency
Types of Operating Systems
Computer storage capacity
Word length of a machine
D
null
543
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What is the main difference between digital computers and analog computers?()
Data processing method
Storage capacity size
Computational speed
Application fields
A
null
544
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What are the characteristics of a computer with von Neumann architecture?()
Multiple Instruction Stream, Multiple Data Stream system (MISD)
Instructions and data are both represented in binary code.
Primarily used for graphics processing
Design centered around the operator
B
null
545
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
How is data transfer conducted between input/output devices and memory in modern computer systems?()
Through the operator
Directly completed between I/O devices and memory
Through dedicated external devices
Requires manual intervention
B
null
546
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
What is the difference between a Database Management System (DBMS) and a Database System (DBS)?()
DBMS is a hardware device, DBS is a software system.
DBMS is application software, while DBS is system software.
DBMS is system software, and DBS includes the database and the database management system.
DBMS is a programming language, DBS is a collection of databases.
C
null
547
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
In computing, the term "transparent" is often used to refer to what?()
Data Visualization
Some components are not visible to the user.
The openness of the system
Network Connectivity
B
null
548
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
The development of microcomputers is marked by ( ) technology.
Operating System
Microprocessor
disk
Software
B
null
549
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
A complete computer system should include ().
Arithmetic Logic Unit (ALU), Memory, Control Unit
Peripheral devices and host computer
Host and Application
The accompanying hardware devices and software systems
D
null
550
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
The following statement is incorrect ( )
The hard drive is an external device.
The functions of software are logically equivalent to those of hardware.
The functions implemented in hardware generally have higher execution speeds than those implemented in software.
The functions of software cannot be replaced by hardware.
D
null
551
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
CPU does not include ().
Address Register
Address Decoder
Instruction Register (IR)
General-purpose register
B
null
552
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
In the operator, does not include ( ).
Status Register
Data Bus
ALU
Address Register
D
null
553
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
The following ( ) belongs to application software.
Linker program
Operating System
Compiler
Text Processing
D
null
554
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
The following ( ) is not considered system software.
Database System
Operating System
Compiler
All three of the above belong to system programs.
A
null
555
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
Regarding associative memory, the correct statement among the following is ( ).
Addressing can only be done by address.
Content Addressable Only
Addressable by both address and content
The statements above are all incomplete.
C
null
556
Test
Computer Organization
Overview
Multiple-choice
Knowledge
English
The hierarchy of computer systems can be divided into 6 levels, and the dependency relationship between these levels is ( ).
The upper and lower layers are mutually independent.
The upper layer extends the functionality of the lower layer, while the lower layer is the foundation for the implementation of the upper layer.
The upper layer extends the functionality of the lower layer, while the lower layer imposes constraints on the upper layer.
The relationship between the upper and lower layers is interdependent and inseparable.
B
null