Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7. Value: 1 point. Exactly one of the following statements is true. Which one? A. The time taken by an insertion sort is proportional to

image text in transcribed
image text in transcribed
image text in transcribed
7. Value: 1 point. Exactly one of the following statements is true. Which one? A. The time taken by an insertion sort is proportional to the number of items to be sorted. B. A selection sort is quicker than an insertion sort if the items are already partially sorted. C. In sorts that run in quadratic time, it is usually quicker to sort elements into ascending order rather than into descending order. D. The number of comparisons made by an insertion sort is the same regardless of the initial ordering of the items to be sorted. E. For a given positive integer n, a merge sort of an array of n elements will always take about the same time regardless of the initial ordering of the elements. Questions 8 and 9 refer to this code: public static void order { int[] a) for (int i = 0; i alk) { int t = a[i]; al i ! - al kli al ki = t; 8. Value: 1 point. In which order do the elements of a appear after the following code is executed? int[] a = ( 4, 2, 3, 5); order( a ); A. 4 2 3 5 B. 5 4 3 2 C. 2 3 4 5 D. 5 2 3 4 E. 2 5 4 3 9. Value: 1 point. If the method order takes approximately 1 second to execute when the argument is an array of length 10, about how long would it take when the argument is an array of length 100? A. 2 seconds B. 10 seconds C. 100 seconds D. 10 minutes E. 100 minutes 10. Value: 1 point. A method that implements a merge sort takes 1 second to sort 128 items. Approximately how long would the same method take to sort an array of 512 items? A. 2 seconds B. 5 seconds C. 30 seconds D. 1 minute E. 2 minutes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

1. How dangerous are Spectre and Meltdown? Explain your answer.

Answered: 1 week ago