Cody

Solution 2585110

Submitted on 19 Jun 2020 by Ramesh Kumar V
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))

m = 6 n = 1 b = 6×1 logical array 0 0 1 0 1 0 a1 = 0 0 a2 = 1 3 5 -1 y = 0 0 1 3 5 -1 c = 0 0 1 3 5 -1 d = 0 0 1 3 5 -1

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

m = 5 n = 1 b = 5×1 logical array 1 1 0 0 0 a1 = 0 0 a2 = 9 2 6 y = 0 0 9 2 6 c = 0 0 9 2 6 d = 0 0 9 2 6

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

m = 4 n = 1 b = 4×1 logical array 0 0 0 0 a1 = 0×1 empty double column vector a2 = 1 3 5 -1 y = 1 3 5 -1 c = 1 3 5 -1 d = 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))

m = 7 n = 1 b = 7×1 logical array 1 0 1 0 0 0 1 a1 = 0 0 0 a2 = 1 1 1 1 y = 0 0 0 1 1 1 1 c = 0 0 0 1 1 1 1 d = 0 0 0 1 1 1 1