Cody

# Problem 70. Alphabetize by last name

Solution 2818750

Submitted on 11 Aug 2020
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

alpha_list = 1×3 cell array {'Dagwood Bumstead'} {'Barney Google'} {'Snuffy Smith'} z1 = 1×3 cell array {1×2 cell} {1×2 cell} {1×2 cell} m1 = 3 z2 = [] z2ind = []

Unrecognized function or variable 'm'. Error in alphabetize (line 10) for k = 1:m Error in Test1 (line 3) assert(isequal(alphabetize(list),alpha_list))

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' } z1 = 12×1 cell array {1×2 cell} {1×2 cell} {1×3 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} {1×2 cell} m1 = 12 z2 = [] z2ind = []

Unrecognized function or variable 'm'. Error in alphabetize (line 10) for k = 1:m Error in Test2 (line 25) assert(isequal(alphabetize(list),alpha_list))