(How is your sorting study?) Sort specific Exercises

Source: Internet
Author: User

1. when sorting records have been sorted from small to large or have been sorted from large to small , the execution time of quick sort is the most ()

A. for

B. Wrong

Answer : B

According to the characteristics of the fast-track, the efficiency is the lowest in the basic order of fast sorting, and the most efficient in the basic disorder.

2. The least time complexity in the following sort is

A. Merge Sort

B. Select Sort

C. Hill Sort

D. Heap Sequencing

Answer : B

Sorting methods

Average Time

Best time

Worst time

Bucket Sort ( unstable )

O (N)

O (N)

O (N)

Base Sort ( stable )

O (N)

O (N)

O (N)

Merge Sort ( stable )

O (NLOGN)

O (NLOGN)

O (NLOGN)

Quick Sort ( unstable )

O (NLOGN)

O (NLOGN)

O (n^2)

Heap Sort ( unstable )

O (NLOGN)

O (NLOGN)

O (NLOGN)

Hill Sort ( unstable )

O (n^1.25)

Bubble Sort ( stable )

O (n^2)

O (N)

O (n^2)

Select Sort ( unstable )

O (n^2)

O (n^2)

O (n^2)

Direct Insert Sort ( stable )

O (n^2)

O (N)

O (n^2)

3. worst case Insertsort, quick Sort, what is the complexity of merge sort?

A. O (n*n), O (Nlogn), O (n*n)

B. O (n*n), O (n*n), O (Nlogn)

C. O (n*n), O (Nlogn), O (Nlogn)

D. O (Nlogn), O (Nlogn), O (Nlogn)

Answer : B

be aware that in the worst case, the complexity of the O (N*n), and the merge sort is not affected by the order of the initial state.

4. set a file by the internal sorting to get The initial merge segment (initial shun string), if the use of multi-merge sorting algorithm, and requires three times the merge to complete the sorting, asked to merge the number of a minimum of

A. 8

B. 7

C. 6

D. 5

Answer :D

5^3=125>100

5. A large-to-small array, sorted by the following sorting methods to small to large, () the fastest.

A. Insert Sort

B. Bubble Sort

C. Quick Sort

D. Heap Sequencing

Answer :D

The above situation is worst for insert sort, bubble sort, quick sort

6. The fast sequencing method is most detrimental to its strengths in the case of ()

A. the amount of data to sort is too large

B. The data to be sorted contains multiple identical values

C. The number of data to sort is odd

D. The data to be sorted is basically orderly

Answer :D

can refer to 1 questions

7. the following sorting algorithm, in the case of ordered data order, the most time spent is ()

A. Quick Sort

B. Hill Sort

C. Bubble Sort

D. Heap Sequencing

Answer : A

can refer to 1 questions


8. The time complexity of the following sorting algorithms is independent of the initial arrangement of records

A. Insert Sort

B. Heap Sequencing

C. Quick Sort

D. Bubble Sort

Answer : B


9. There is a character sequence (q,h,c,y,p,a,m,s,r,d,f,x), a new sequence (f,h,c,d,p,a,m,q , R,s,y,x) is the following () sorting algorithm for a trip to the scan results.

A. Heap Sequencing

B. Quick Sort

C. Hill Sort

D. Bubble Sort

Answer : B

I feel this kind of problem basically is saying the quick platoon ...

In order to sort the sequence of elements is basically ordered, the most efficient ranking method is?

A. Insert Sort

B. Select Sort

C. Quick Sort

D. Merge Sort

Answer : A (Note and section 5 comparison of the questions)



(How is your sorting study?) Sort specific Exercises

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.