Problem 44538. Arrange the names in alphabetical order (1)

Arrange the list of names in alphabetical order. The original 'alphabetical order', that is: from α and β all the way through to ω. We might call this 'alpha-beta-cal order'!

You do not need to heed the capitalisation (uppercase versus lowercase) in determining the correct sequence, although it must be preserved in your final output.

Accents or diacritics should not be heeded in determining the correct sequence, but should likewise be retained in the final output. This is consistent with some practice, albeit not universal. Only the 'tonos' will be present in the Test Suite (unless you try the optional Bonus Question).

Sorting should be based on the surname [family name], where present. The surname will always appear last, if present. In principle, if two surnames were alike, then one would have to next sort by the given name(s) [first name(s)] — however, that situation does not arise, and will not arise, in the Test Suite.

Inputs comprise cell arrays of character vectors. The cell arrays can be either row or column vectors. Return your output in the same type of vector.


 % Input
 in = {'Δημήτρης Δραγατάκης'; 'Ρίτα Αμπατζή'}
 % Output
 out = {'Ρίτα Αμπατζή'; 'Δημήτρης Δραγατάκης'}

Although Δ (delta, ~d) precedes Ρ (rho, ~r) in the Greek alphabet, we must sort first by surname, for which Α (alpha, ~a) precedes Δ (delta, ~d).

See also:

Solution Stats

20.9% Correct | 79.1% Incorrect
Last Solution submitted on Apr 24, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers8

Suggested Problems

More from this Author32

Community Treasure Hunt

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

Start Hunting!