Gce Model Questions Vol1 2023 Computer Studies Question 5

Practice objective / multiple choice question 5 from the 2023 Gce Model Questions Vol1 Computer Studies examination.

Gce Model Questions Vol1 2023 Computer Studies Objective / Multiple Choice Medium Difficulty
Question 5 GCE_MODEL_QUESTIONS_VOL1 • 2023 • COMPUTER_STUDIES • objective

Consider the following recursive sorting routine written in pseudocode: ``` procedure weirdSort(A, left, right) if left >= right then return mid ← floor((left + right) / 2) weirdSort(A, left, mid) weirdSort(A, mid + 1, right) for i ← left to right - 1 do if A[i] > A[i+1] then swap A[i] and A[i+1] ``` The routine is applied to an array \(A\) containing \(n\) distinct elements, where \(n\) is a power of two. Let \(C(n)\) denote the total number of comparisons performed by the `if` statement in the `for` loop over the entire execution of `weirdSort`. Derive a recurrence for \(C(n)\) and compute \(C(8)\).

Answer Options

Correct Answer A. 17
B. 23
C. 19
D. 15
Correct Answer
A
Correct Option:
17

About This Question

This is Gce Model Questions Vol1 2023 Computer Studies Question 5. It is one of the objective questions from the 2023 Gce Model Questions Vol1 Computer Studies examination.

Difficulty level: Medium .

Master the Exam!

You've seen a preview, but there are thousands more questions plus AI tutor to break down complex solutions.

Unlock Full Access Available for Android & Windows
Chat with Support