2.26 Sort fill special test questions

  • If the input is already sorted, following the fastest sorting algorithm is ()
    A. insertion sort
    B. Shell sort
    C. merge sort
    D. Quick Sort

    Analysis: Ruoyi sorted using insertion sort of time as long as once pairwise comparison, the complexity is O (n).
    Answer: A

  • Sort by AOE network topology is the earliest time for each node of the event node sort, this statement correct?
    A. Correct
    not correct B.

    Analytical: AOE network is a directed acyclic graph, find the topological sort there are two methods: 1, the depth-first search of FIG, arranged in reverse chronological order according to the node to complete to obtain a topological sort, looking into the degree of 0 node, an output, and deletes the node from the further procedure is repeated for all sides, i.e., to obtain a topological sort FIG. It should be noted: Map topological sort is not unique.
    Answer: B

  • If there are records 3,110,400, do merge sort 6 balanced on the external storage, computer work area of memory 400 can accommodate the recording, the sort records all good, need to make several times merge sort ()
    A. 6
    B.. 3
    C.. 5
    D 4

    Analytical: log (6,3110400 / 400) = 5 number of times provided merge s times, the n records are sorted, merged segments with m, k-way merge sort to, the number of times the merged s = log (k, m);
    answer: C

  • Sorting exchange sequence is a series of comparison elements, the comparison when the two elements are in reverse order, exchange, and bubble sort quick sort sorted based on the most two kinds of such methods, bubble sorting algorithm bad time complexity is O (n * n), and fast sort algorithm is the worst case time complexity of O (nlog2 n); quicksort therefore higher efficiency than the bubble sort ( × )

  • All internal sorting methods are sorted by key based on the comparison. ( × )

  • To place a bureau service number of sort is necessary to detect the opening of a local telephone number if there is a prefix of another case, to simplify the logic of the telephone exchange. For example: a user number is "11001100", but "110" to generate the telephone prefix match. Known local telephone number up to 8, the shortest three, and all three telephone numbers begin with 1. Since many local telephone number, the length may not have been efficient algorithm can be done in O (n) time complexity detection (n is the number of local telephone numbers opening, a number of tens of millions). So, in the worst case the algorithm takes about ________ memory space.
    5GB A.
    B. 500MB
    C. 50MB
    D. 5MB

    Analysis: up to 8, 6 cases a minimum of 3:
    three are the first 1, 10 is therefore 2 ^ = 100 types of
    four: 10 ^ 4 = 10,000
    five: 10 ^ 5 = 100,000 species
    six: 10 ^ 6 = 1,000,000
    seven: 10 ^ 7 = 10,000,000 kinds of
    eight: 10 ^ 8 = 100,000,000 kinds
    sum total of 111,110,100 species because the only phone number, all the numbers do not judge the last one, the total number divided by 10 = 11,111,010 types
    a number 4bit (number from 0-9, so the least bit with four bits to represent), 8-bit number that is accounted for 32bit 4 bytes / byte (actually only the first 7 can be stored, 3.5byte)
    last: 11,111,010 * 4/1024/1024

    = 42.4 Mb answer: C

  • In the following ordering algorithm, comparing the initial key arrangement order irrespective of the number of records is ().
    A. Hill sorting
    B. bubble sort
    C. insertion sort
    D. Direct Selection Sort

    Analysis: Selection Sort always need to traverse the rest of the sequence to find the maximum or minimum value of exchange current position regardless of time under what circumstances complexity are O (N2)
    Answer: D

  • Topological ordering operations can only be used ( directed acyclic graph )

  • The average length of the initial period when the external merge sort method using the selection tree generated in the memory buffer to accommodate recording of m recording is 2m

  • When the elements to be sorted smaller scale, what the most efficient sorting algorithm () should select
    A. HEAPSORT
    B. merge sort
    C. bubble sort
    D. Hill sorting

    Analysis: Comparison of time may be longer than the recursive
    answer: C

  • Sorting algorithm suitable for parallel processing is () A. B. Rapid Selection Sort Sort Sort C. Hill

    D. radix sort

    Analysis: radix sort: all values to be compared (a positive integer) for the same number of uniform bit length, the shorter number of digits with leading zeros. Then, from the lowest Start, once
    sorted. This has been sorted from the lowest to the highest order of the bits is completed, the series becomes an ordered sequence. Simultaneous operation of a plurality of elements, thereby realizing parallel processing.

    Answer: D

Guess you like

Origin www.cnblogs.com/l999q/p/12369934.html