Cody

Problem 70. Alphabetize by last name

Solution 597635

Submitted on 17 Mar 2015 by Ze Zhang
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 = 'Dagwood Bumstead' 'Barney Google' 'Snuffy Smith' alpha_list = 'Dagwood Bumstead' alpha_list = 'Dagwood Bumstead' 'Barney Google' alpha_list = 'Dagwood Bumstead' 'Barney Google' 'Snuffy Smith'

2   Pass
%% 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 = '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' alpha_list = 'George Bush' alpha_list = 'George Bush' 'George Bush' alpha_list = 'George Bush' 'George Bush' 'Bill Clinton' alpha_list = 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' alpha_list = 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' alpha_list = Columns 1 through 5 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' Column 6 'Lyndon Johnson' alpha_list = 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' 'Lyndon Johnson' 'John F. Kennedy' alpha_list = Columns 1 through 5 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' Columns 6 through 8 'Lyndon Johnson' 'John F. Kennedy' 'Cleve Moler' alpha_list = 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' 'Lyndon Johnson' 'John F. Kennedy' 'Cleve Moler' 'Richard Nixon' alpha_list = Columns 1 through 5 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' Columns 6 through 10 'Lyndon Johnson' 'John F. Kennedy' 'Cleve Moler' 'Richard Nixon' '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' alpha_list = Columns 1 through 5 'George Bush' 'George Bush' 'Bill Clinton' 'Dwight Eisenhower' 'Gerald Ford' Columns 6 through 10 'Lyndon Johnson' 'John F. Kennedy' 'Cleve Moler' 'Richard Nixon' 'Barack Obama' Columns 11 through 12 'Ronald Reagan' 'Harry Truman'

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!