Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we are sorting an array of nine integers using quicksort, and we have just finished the first partitioning with the array looking like this:

Suppose we are sorting an array of nine integers using quicksort, and we have just finished the first partitioning with the array looking like this: 4 2 3 8 9 11 13 12 10 Which statement is correct?

A) Either 8 or 9 could be the pivot

B) 8 could be the pivot, but 9 cannot

C) 9 could be the pivot, but 8 cannot

D) Neither 8 nor 9 can be the pivots

Which of the following sorting algorithms in its typical implementation gives best performance when applied on an array which is sorted or almost sorted (maximum 1 or two elements are misplaced).

A) Insertion sort

B) Selection Sort

C) Bubble Sort

D) All of the above

What does the below array look like after 2 passes/iterations of Selection Sort (when sorting in increasing order)?

A) 6, 5, 1, 2, 0

B) 0, 5, 1, 2, 6

C) 0, 1, 2, 5, 6

D) 0, 1, 6, 2, 5

E) 0, 1, 5, 2, 6 1

What is the time complexity of the merge phase in mergesort ?

A) O(n)

B) O(n log n)

C) O(log n)

D) O(log (log n))

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

Step: 3

blur-text-image

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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

5. What role does power play in determining our cultural spaces?

Answered: 1 week ago