I need help with two algorithm tasks that involve choosing and justify choice of a sorting algorithm and providing pseudocode for another sorting algorithm.
## Deliverables
First task:
You have been asked to select an appropriate sorting algorithm for your workplace. The objects you
need to sort are items from an inventory. Each item carries an identification number (Integer) and a
name (String). Your boss expects that it should be possible to sort on both identification number and
name. There are about 1,000,000 entries in the database of items to be sorted.
In some cases, there are items with the same name but different identification numbers. If a user first
sorts by identification number and then by name, the individual ordering of items of the same name
should be in ascending order based on their identification number. That means that, given three items
called “Car?? with the identification numbers 314, 812 and 345, after sorting on identification number
and then on name, the list should contain:
Car 314
Car 345
Car 812
Please select an appropriate sorting method for this given task, and provide a justification for why you
selected this particular sorting method.
Second task:
You have been asked to write a custom algorithm for a customer with very peculiar demands when it
comes to sorting and organising information. The customer has an array of about 100,000 elements
where each element of the array contain two numbers, a and b. These can be referenced as A[i][a] and
A[i][b] respectively where i is the element number in the array.
The customer wants you to write an algorithm which sorts the array first by the value of a, and
secondly by the number of b multiplied by a. That means that given the following array of values:
[1,3], [2, 4], [2, 2], [5, 1], [4, 9] (given as [a, b], with a total of five elements in the array)
The sorted list should be:
[1, 3], [2, 2], [2, 4], [4, 9], [5, 1]
Please provide pseudocode for an appropriate algorithm. You are allowed to base your code on existing
sorting methods, but you need to make use of A[i][a] and A[i][b] respectively. You are allowed to
change the logic of the sorting, if you can prove that your algorithm will produce the same sorting as
what the customer wanted, even if the logic is different.