Cody

Solution 2608543

Submitted on 24 Jun 2020 by Othman Salih
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))

vrc = [] rows = 3 columns = 3 zeroz = [] nonzeroz = [] nonzeroz = 1 vrc = 1 zeroz = 0 vrc = 0 1 nonzeroz = 1 6 vrc = 0 1 6 b = 0 1 6 zeroz = [] nonzeroz = [] nonzeroz = 2 vrc = 2 nonzeroz = 2 4 vrc = 2 4 zeroz = 0 vrc = 0 2 4 b = 0 0 1 2 6 4 zeroz = [] nonzeroz = [] nonzeroz = 3 vrc = 3 nonzeroz = 3 5 vrc = 3 5 zeroz = 0 vrc = 0 3 5 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))

vrc = [] rows = 7 columns = 1 zeroz = [] nonzeroz = [] nonzeroz = 1 vrc = 1 zeroz = 0 vrc = 0 1 nonzeroz = 1 5 vrc = 0 1 5 zeroz = 0 0 vrc = 0 0 1 5 nonzeroz = 1 5 7 vrc = 0 0 1 5 7 zeroz = 0 0 0 vrc = 0 0 0 1 5 7 nonzeroz = 1 5 7 6 vrc = 0 0 0 1 5 7 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))

vrc = [] rows = 2 columns = 2 zeroz = [] nonzeroz = [] nonzeroz = 1 vrc = 1 nonzeroz = 1 1 vrc = 1 1 b = 1 1 zeroz = [] nonzeroz = [] zeroz = 0 vrc = 0 nonzeroz = 1 vrc = 0 1 b = 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))

vrc = [] rows = 5 columns = 1 zeroz = [] nonzeroz = [] zeroz = 0 vrc = 0 nonzeroz = 8 vrc = 0 8 zeroz = 0 0 vrc = 0 0 8 nonzeroz = 8 6 vrc = 0 0 8 6 nonzeroz = 8 6 -2 vrc = 0 0 8 6 -2 b = 0 0 8 6 -2