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'}
alpha_list =
1×1 cell array
{'Dagwood Bumstead'}
alpha_list =
2×1 cell array
{'Dagwood Bumstead'}
{'Barney Google' }
alpha_list =
1×3 cell array
{'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 =
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' }
alpha_list =
1×1 cell array
{'George Bush'}
alpha_list =
2×1 cell array
{'George Bush'}
{'George Bush'}
alpha_list =
1×3 cell array
{'George Bush'} {'George Bush'} {'Bill Clinton'}
alpha_list =
4×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
alpha_list =
1×5 cell array
{'George Bush'} {'George Bush'} {'Bill Clinton'} {'Dwight Eisenhower'} {'Gerald Ford'}
alpha_list =
6×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
{'Gerald Ford' }
{'Lyndon Johnson' }
alpha_list =
1×7 cell array
{'George Bush'} {'George Bush'} {'Bill Clinton'} {'Dwight Eisenhower'} {'Gerald Ford'} {'Lyndon Johnson'} {'John F. Kennedy'}
alpha_list =
8×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
{'Gerald Ford' }
{'Lyndon Johnson' }
{'John F. Kennedy' }
{'Cleve Moler' }
alpha_list =
1×9 cell array
Columns 1 through 8
{'George Bush'} {'George Bush'} {'Bill Clinton'} {'Dwight Eisenhower'} {'Gerald Ford'} {'Lyndon Johnson'} {'John F. Kennedy'} {'Cleve Moler'}
Column 9
{'Richard Nixon'}
alpha_list =
10×1 cell array
{'George Bush' }
{'George Bush' }
{'Bill Clinton' }
{'Dwight Eisenhower'}
{'Gerald Ford' }
{'Lyndon Johnson' }
{'John F. Kennedy' }
{'Cleve Moler' }
{'Richard Nixon' }
{'Barack Obama' }
alpha_list =
1×11 cell array
Columns 1 through 8
{'George Bush'} {'George Bush'} {'Bill Clinton'} {'Dwight Eisenhower'} {'Gerald Ford'} {'Lyndon Johnson'} {'John F. Kennedy'} {'Cleve Moler'}
Columns 9 through 11
{'Richard Nixon'} {'Barack Obama'} {'Ronald Reagan'}
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' }
|
Swap the first and last columns
12415 Solvers
404 Solvers
201 Solvers
387 Solvers
549 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!