Sorting persons

Report a typo

Below are six tuples. The first element is the name of a person, the second is their age.

1) name = "John Grant",  age = 30
2) name = "Mary Violet", age = 26
3) name = "James Brown", age = 26
4) name = "August Tuckerberg", age = 40
5) name = "Catherina Garcia", age = 30
6) name = "Stephen Benton", age = 20

Perform a manual stable sorting by age from youngest to oldest.

Hint: In the context of sorting, stable sorting means that if two elements have equal values (e.g., the same age), their relative order in the sorted list remains the same as in the original list.
Put the items in the correct order
name = "John Grant", age = 30
name = "Mary Violet", age = 26
name = "Stephen Benton", age = 20
name = "Catherina Garcia", age = 30
name = "James Brown", age = 26
name = "August Tuckerberg", age = 40
___

Create a free account to access the full topic