Starting from:

$30

Assignment #5 Given a list of student names

Assignment #5 (10 points)
1. Given a list of student names and corresponding quiz scores, we’d sort in a number of different ways:
(1) sort in ascending order of names, if same name ascending order of scores;
(2) sort in ascending order of names, if same name descending order of scores;
(3) sort in descending order of names, if same name descending order of scores.

Use any language (of your choice) to program the above tasks by writing one sort function only but may have a number of auxiliary (help) functions for ordering.
Then, write a main function/program that makes three calls to the sort function to accomplish the above three different sorting tasks. Test the program using the following data (note: you may store data in an array or a list or whatever data structure you think appropriate.) Initialize the input data in the program instead of entering from keyboard or reading from file.
Dan 45
Adam 39
Fiona 42
Kathy 44
Dan 34
Adam 41
Kalin 50
Adam 40
Zehr 43
Mona 42
Kevin 35
Elma 48

2. (Use a typed language that supports generic subprogram – note: Python not eligible) Write a generic function find_max that finds the first occurrence of the “largest” element in a matrix. For example, in the following 3x4 matrix of integers [[1,2,4,4],[5,5,4,2],[3,1,1,5]], the first occurrence of the largest element is 5 at position/indices (1,0). In the following 5x2 matrix of strings [[“David”, “Kelin”, “Peter”, “Zag”, “Diana”], [“Elin”, “Adam”, “Young”, “Peter”, “Zag”]], the first occurrence of the largest element is “Zag” at position/indices (0,3).
Write a main program to provide at least two test runs. You may use input data similar to the above but with larger matrix sizes. Initialize the input data in program code.
Submission:
Save program source codes and input/output test runs (screen dumps, script file or any other way showing your execution output) for both problems in a pdf file and submit on blackboard via the assignment link.

More products