Question: Initialize array C of size 2 n 2 . i 0 3 . j 0 4 . S 0 Comment: S will count swaps; the
Initialize array C of size n
i
j
S Comment: S will count swaps; the answer lines below which you have to add will be
responsible for changing S
While i n OR j n
a if j n or Ai Bj :
S j
set next element of C to Ai
formally Ci j Ai
i i
b if i n or Ai Bj:
Cij Bj
j
set next element of C to Bj
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
