Cody

Solution 923116

Submitted on 14 Jul 2016 by Ivo Georgiev
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))

b = 1 2 3 0 4 5 6 0 0 j = 3 iNzero = 1 3 1 2 1 2 jNzero = 1 1 2 2 3 3 iZero = 2 3 3 b = 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))

b = 1 0 5 0 7 0 6 j = 1 iNzero = 1 3 5 7 jNzero = 1 1 1 1 iZero = 2 4 6 b = 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))

b = 1 0 1 1 j = 2 iNzero = 1 2 2 jNzero = 1 1 2 iZero = 1

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

b = 0 8 0 6 -2 j = 1 iNzero = 2 4 5 jNzero = 1 1 1 iZero = 1 3 b = 0 0 8 6 -2