Cody

Solution 2406607

Submitted on 28 May 2020 by Jerry Wright
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 = [ 1 2 3 0 4 5 6 0 0 ]; b_correct = [ 0 0 0 1 2 3 6 4 5 ]; assert(isequal(bubbles(a),b_correct))

r = 3 c = 3 x = 1 0 6 k = 3×1 logical array 1 0 1 Y = 0 1 6 x = 2 4 0 k = 3×1 logical array 1 1 0 Y = 0 0 1 2 6 4 x = 3 5 0 k = 3×1 logical array 1 1 0 Y = 0 0 0 1 2 3 6 4 5

2   Pass
a = [ 1 0 5 0 7 0 6 ]'; b_correct = [ 0 0 0 1 5 7 6 ]'; assert(isequal(bubbles(a),b_correct))

r = 7 c = 1 x = 1 0 5 0 7 0 6 k = 7×1 logical array 1 0 1 0 1 0 1 Y = 0 0 0 1 5 7 6

3   Pass
a = [1 0; 1 1]; b_correct = [1 0; 1 1]; assert(isequal(bubbles(a),b_correct))

r = 2 c = 2 x = 1 1 k = 2×1 logical array 1 1 Y = 1 1 x = 0 1 k = 2×1 logical array 0 1 Y = 1 0 1 1

4   Pass
a = [0 8 0 6 -2]'; b_correct = [0 0 8 6 -2]'; assert(isequal(bubbles(a),b_correct))

r = 5 c = 1 x = 0 8 0 6 -2 k = 5×1 logical array 0 1 0 1 1 Y = 0 0 8 6 -2