Question 2Suppose you do not have access to a sorting library. Which sorting algorithm would you implement for each of the following sorting problems, and why?


TestName Numberofruns Avgresult 
The name is a string without spaces. The number of runs is an integer, and the avgresult is a double. A small example file is shown below:
BORINGMINERAL 4 45.353 DULLROCK 9 59.408 BORINGMINERAL 5 41.327 DULLROCK 1 77.155 SOPORIFICFOSSIL 5 15.116 
As you can see, some tests have multiple lines, because they are run at different times. Your boss would like to see the total number of runs for each test, and she's been trying to get excel to do it, but that is leading to frustration. She wants you to write a simple program that reads the input file, then outputs each test preceded by its total number of runs. The output should be sorted from most runs to least. If two tests have the same number of runs, don't worry about their relative order. Print the number of tests rightjustified, padded to four characters. For example, on the input to the right, you'll get the following output:
10 DULLROCK 9 BORINGMINERAL 5 SOPORIFICFOSSIL 
Question 4Part A: Draw the vector representation of the heap to the right.Part B: Draw the heap that results when when you call Push(2) on the heap to the right. Part C: Draw the heap that results when when you call Pop() on the heap to the right. Do not call Pop() on your answer to Part B  call it on the heap to the right.


There are two ways that we learned to implement this constructor. The first simply calls Push() on each element. I want you to draw me the heap that results when you implement it in the second, more efficient way. Don't bother drawing the vector representation  draw the graphical representation.
Part E: Suppose a heap contains n elements. What is the running time (bigO) of Push()?
Part F: Suppose a heap contains n elements. What is the running time (bigO) of Pop()?
Part G: What is the running time (bigO) of constructing a heap from a vector with n elements as in Part D?
void print_subset(int subset, vector <string> &names); 
The vector names has fewer than 31 elements. Thus, we can represent any subset of names with an integer, as described in class. Write print_subset(), which prints the elements of names that are in the specified integer subset. You'll have to use bit arithmetic. Just print one name per line.