Cody

Solution 1879909

Submitted on 20 Jul 2019
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
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'} new = [] 'Barney Google' split = 1×2 string array "Barney" "Google" a last = "Google" new = "Google" 'Snuffy Smith' split = 1×2 string array "Snuffy" "Smith" a last = "Smith" new = 1×2 string array "Google" "Smith" 'Dagwood Bumstead' split = 1×2 string array "Dagwood" "Bumstead" a last = "Bumstead" new = 1×3 string array "Google" "Smith" "Bumstead" new2 = 1×3 string array "Bumstead" "Google" "Smith" new2 = 1×3 string array "Bumstead" "Barney Google" "Smith" new2 = 1×3 string array "Bumstead" "Barney Google" "Snuffy Smith" new2 = 1×3 string array "Dagwood Bumstead" "Barney Google" "Snuffy Smith" alpha_list = 1×3 string array "Dagwood Bumstead" "Barney Google" "Snuffy Smith"

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' } new = [] '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' split = 1×2 string array "Harry" "Truman" a last = "Truman" new = "Truman" new2 = "Truman" alpha_list = "Truman"

Assertion failed.