Cody

Problem 45508. AK Sorting according to given order

Solution 2276060

Submitted on 13 May 2020 by bainhome
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))

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))

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))

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))

Suggested Problems