Cody

Problem 45508. AK Sorting according to given order

Solution 2270503

Submitted on 11 May 2020 by shaikh akbar shaikh rasul
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
a = [ 3 8 7 5 0 9 2 1 6 4]; b= [ 2 4 5 5 3 3 3 9 0]; c_correct =[3,3,3,5,5,0,9,2,4]; assert(isequal(ak_sorting(a,b),c_correct))

k = 4 k = 6 k = 7 k = 8 k = 9 k = 10

2   Pass
a = [ 0 1 2 3 4 5 6 7 8 9]; b= [ 5 6 7 3 5 1 9 0 5 6 7 8 2 4 5]; c_correct = [0 1 2 3 4 5 5 5 5 6 6 7 7 8 9]; assert(isequal(ak_sorting(a,b),c_correct))

k = 2 k = 3 k = 4 k = 5 k = 6 k = 10 k = 12 k = 14 k = 15 k = 16

3   Pass
a = [ 9 8 7 6 5 4 3 2 1 0]; b= [3 4 1 2 3 4 1 2 3 4 1 2]; c_correct = [4 4 4 3 3 3 2 2 2 1 1 1]; assert(isequal(ak_sorting(a,b),c_correct))

k = 4 k = 7 k = 10 k = 13

4   Pass
a = [4 5 7 8 0 3 1 2 9 6]; b= [5 4 3 8 7 6 5 4 3 5 3 2 1 0 9 1]; c_correct = [4 4 5 5 5 7 8 0 3 3 3 1 1 2 9 6]; assert(isequal(ak_sorting(a,b),c_correct))

k = 3 k = 6 k = 7 k = 8 k = 9 k = 12 k = 14 k = 15 k = 16 k = 17

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!