Cody

Solution 2001217

Submitted on 3 Nov 2019 by dilek bulut
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'} r = 2×1 cell array {'Barney'} {'Google'} surn = 1×1 cell array {'Google'} r = 2×1 cell array {'Snuffy'} {'Smith' } surn = 2×1 cell array {'Google'} {'Smith' } r = 2×1 cell array {'Dagwood' } {'Bumstead'} surn = 3×1 cell array {'Google' } {'Smith' } {'Bumstead'} u = 3×1 string array "Google" "Smith" "Bumstead" j = 3×1 string array "Bumstead" "Google" "Smith" idx = 3 1 2

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' } r = 2×1 cell array {'Harry' } {'Truman'} surn = 1×1 cell array {'Truman'} r = 2×1 cell array {'Dwight' } {'Eisenhower'} surn = 2×1 cell array {'Truman' } {'Eisenhower'} r = 3×1 cell array {'John' } {'F.' } {'Kennedy'} surn = 3×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } r = 2×1 cell array {'Lyndon' } {'Johnson'} surn = 4×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } r = 2×1 cell array {'Richard'} {'Nixon' } surn = 5×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } r = 2×1 cell array {'Gerald'} {'Ford' } surn = 6×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } r = 2×1 cell array {'Cleve'} {'Moler'} surn = 7×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } r = 2×1 cell array {'Ronald'} {'Reagan'} surn = 8×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } {'Reagan' } r = 2×1 cell array {'George'} {'Bush' } surn = 9×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } {'Reagan' } {'Bush' } r = 2×1 cell array {'Bill' } {'Clinton'} surn = 10×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } {'Reagan' } {'Bush' } {'Clinton' } r = 2×1 cell array {'George'} {'Bush' } surn = 11×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } {'Reagan' } {'Bush' } {'Clinton' } {'Bush' } r = 2×1 cell array {'Barack'} {'Obama' } surn = 12×1 cell array {'Truman' } {'Eisenhower'} {'Kennedy' } {'Johnson' } {'Nixon' } {'Ford' } {'Moler' } {'Reagan' } {'Bush' } {'Clinton' } {'Bush' } {'Obama' } u = 12×1 string array "Truman" "Eisenhower" "Kennedy" "Johnson" "Nixon" "Ford" "Moler" "Reagan" "Bush" "Clinton" "Bush" "Obama" j = 12×1 string array "Bush" "Bush" "Clinton" "Eisenhower" "Ford" "Johnson" "Kennedy" "Moler" "Nixon" "Obama" "Reagan" "Truman" idx = 9 11 10 2 6 4 3 7 5 12 8 1

Suggested Problems

More from this Author95