Dsa
Sorting
Warm-up
Student Grades Sorter
You have a list of students, each represented by their name and grade in the format 'name grade'. Your task is to sort the students based on their grades in ascending order. If two students have the same grade, sort them alphabetically by name. Print the sorted student list in the original format, one per line.
Example Input:
Alice 85
Bob 75
Charlie 85
David 70
Example Output:
David 70
Bob 75
Alice 85
Charlie 85
Key concepts
sortingtuplesarrays
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now