Cody

Solution 2104111

Submitted on 24 Jan 2020 at 0:46
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   Fail
list = {'Barney Google','Snuffy Smith','Dagwood Bumstead'}; alpha_list = {'Dagwood Bumstead','Barney Google','Snuffy Smith'} assert(isequal(alphabetize(list),alpha_list))

alpha_list = 1×3 cell array {'Dagwood Bumstead'} {'Barney Google'} {'Snuffy Smith'} D = 1×1 cell array {'Bumstead Dagwood'} D = 1×2 cell array {'Bumstead Dagwood'} {'Google Barney'} D = 1×3 cell array {'Bumstead Dagwood'} {'Google Barney'} {'Smith Snuffy'} alpha_list = 1×3 cell array {'Bumstead Dagwood'} {'Google Barney'} {'Smith Snuffy'}

Assertion failed.

2   Fail
list = {'Harry Truman' 'Dwight Eisenhower' 'John F. Kennedy' 'Lyndon Johnson' 'Richard Nixon' 'Gerald Ford' 'Cleve Moler' 'Ronald Reagan' 'George Bush' 'Bill Clinton' 'George Bush' 'Barack Obama'}; alpha_list = {'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' 'Lyndon Johnson' 'John F. Kennedy' 'Cleve Moler' 'Richard Nixon' 'Barack Obama' 'Ronald Reagan' 'Harry Truman'} assert(isequal(alphabetize(list),alpha_list))

alpha_list = 12×1 cell array {'George Bush' } {'George Bush' } {'Bill Clinton' } {'Dwight Eisenhower'} {'Gerald Ford' } {'Lyndon Johnson' } {'John F. Kennedy' } {'Cleve Moler' } {'Richard Nixon' } {'Barack Obama' } {'Ronald Reagan' } {'Harry Truman' }

Error using split (line 99) Element 3 of the text contains 2 delimiters while the previous elements have 1. All elements must contain the same number of delimiters. Error in alphabetize (line 2) A = split(list,' ',2); Error in Test2 (line 25) assert(isequal(alphabetize(list),alpha_list))