Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 4 Assuming the first element is not already the minimum, which of the following describes how the first swap is determined in Selection Sort?

image text in transcribed

QUESTION 4 Assuming the first element is not already the minimum, which of the following describes how the first swap is determined in Selection Sort? The array is scanned for its minimum element, which is then swapped with the first element. The second element is swapped with the first element if it is smaller. Otherwise, nothing happens. O A pass through the array is made where each element is swapped with its neighbor if the second element should come before the first The "select" algorithm is run to find the median element, and this is swapped with the middle element of the array (or element N/2 in an even-length array). QUESTION 5 Which of the following is the result of performing a merge (in the sense of Mergesort) on the following two arrays? [1 359] 123467 A single sorted array: [1 23345679] You can't merge these two arrays, because they have different lengths. Three arrays: [1]. [3 5 9], [23467]. A single array that alternates between the original arrays' elements: [1 2 335496 7] QUESTION 6 Which of the following is true of a merge operation (as used in Mergesort)? A merge always compares every element in one list to every element in the other list The merge always interleaves the two inputs, exactly alternating between an input from one list and an input from the other when constructing the final list. The output of a merge might not be sorted. The two inputs to a merge must be sorted The two inputs to a merge must be the same length. O Every element in each list gets compared to some element in the other list during the merge

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

Students also viewed these Databases questions