Cody

Problem 47588. Sort a vector

Solution 3790263

Submitted on 23 Nov 2020 by Rafael S.T. Vieira
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
x = randi(100,[1,10]); y_correct = sort(x); y = sortVect(x); assert(isequal(y,y_correct))

ans = 1 7 9 21 25 28 41 59 70 96

2   Pass
x = randi(100,[1,50]); y_correct = sort(x); y = sortVect(x); assert(isequal(y,y_correct))

ans = Columns 1 through 30 1 2 3 6 10 12 15 16 19 19 22 25 27 28 37 37 41 42 44 44 46 48 50 50 53 53 58 59 63 65 Columns 31 through 50 66 67 67 67 68 75 76 78 78 79 80 83 83 83 85 87 89 89 98 99

3   Pass
x = randi(100,[1,100]); y_correct = sort(x); y = sortVect(x); assert(isequal(y,y_correct))

ans = Columns 1 through 30 1 3 4 5 5 6 7 7 7 8 9 10 11 12 13 13 15 18 18 20 21 22 22 23 23 24 25 26 28 31 Columns 31 through 60 32 33 34 34 34 34 34 38 40 40 40 41 41 41 46 50 50 50 50 53 54 55 56 57 58 59 59 61 63 63 Columns 61 through 90 64 64 65 65 66 66 67 68 70 70 72 73 74 74 75 76 78 78 78 79 80 84 85 86 87 89 90 90 90 93 Columns 91 through 100 93 94 94 95 95 95 96 96 98 99

4   Pass
assessFunctionAbsence({'sort'}, 'FileName', 'sortVect.m');

Suggested Problems

More from this Author14

Community Treasure Hunt

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

Start Hunting!