Cody

Solution 1528690

Submitted on 14 May 2018 by OZ FEDERMAN
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
filetext = fileread('bubbles.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
v = [1 3 0 5 0 -1]'; w_correct = [0 0 1 3 5 -1]'; assert(isequal(bubbles(v),w_correct))

a = 1 2 4 6 b = 1 3 5 -1 l = 6 e = 4 c = 2 d = 0 0 w = 0 0 1 3 5 -1

3   Pass
v = [0 0 9 2 6]'; w_correct = v; assert(isequal(bubbles(v),w_correct))

a = 3 4 5 b = 9 2 6 l = 5 e = 3 c = 2 d = 0 0 w = 0 0 9 2 6

4   Pass
v = [1 3 5 -1]'; w_correct = v; assert(isequal(bubbles(v),w_correct))

a = 1 2 3 4 b = 1 3 5 -1 l = 4 e = 4 c = 0 d = 0×1 empty double column vector w = 1 3 5 -1

5   Pass
v = [0 1 0 1 1 1 0]'; w_correct = [0 0 0 1 1 1 1]'; assert(isequal(bubbles(v),w_correct))

a = 2 4 5 6 b = 1 1 1 1 l = 7 e = 4 c = 3 d = 0 0 0 w = 0 0 0 1 1 1 1