Part 1: Assume that the queue is as pictured above. Draw the array representation of the priority queue when the maximum value is removed from the queue.
Part 2: Assume that the queue is as pictured above. Draw the array representation of the priority queue when the value 66 is inserted into the queue.
a. O(1)  b. O(log_{2}(n))  c. O(n)  d. O(n log_{2}(n))  e. O(n^{2}))  f. O(n^{3})) 
For each activity, what is the running time complexity of the activity.
void merge(double *a1, int size1, double *a2, int size2, double *a3); 
merge() assumes that a1 is an array of size1 doubles, that a2 is an array of size2 doubles, and that a3 is an array of size1+size2 doubles. It also assumes that a1 and a2 are sorted. When it completes, a3 will contain all the values of a1 and a2 in sorted order.
Write the procedure merge_sort(), with the following prototype:
void merge_sort(double *a, int size); 
You may write a helper procedure or two if you need it.
Obviously, merge_sort() should use merge() to sort the size doubles in array a using the Merge Sort algorithm. Make sure that your procedure does not have a memory leak.
Which of the following are valid preorder printings of the nodes given a depthfirst traversal starting with the node Set. Answer all that are valid (there may be more than one).

Extra Credit: What's the name of the song and who sang it?
#include <iostream> #include <map> #include <set> #include <string> using namespace std; class LNames { public: LNames(string ln, string init_fn); string lname; int n; set <string> fns; }; typedef map <string, LNames *> LNMap; LNames::LNames(string ln, string init_fn) { lname = ln; n = 1; fns.insert(init_fn); cout << "Created " << ln << " with " << init_fn << endl; }  main() { LNMap lnames; LNames *l; string ln, fn; LNMap::iterator lnit; while (!cin.fail()) { cin >> fn; if (!cin.fail()) { cin >> ln; lnit = lnames.find(ln); if (lnit == lnames.end()) { l = new LNames(ln, fn); lnames.insert(make_pair(ln, l)); } else { l = lnit>second; l>fns.insert(fn); l>n++; cout << "Added " << fn << " to " << ln << endl; } } } // HERE } 
What is the output of the above program when the following is given as standard input:
James Woods Ickey Woods Woody Austin Tiger Woods Woody Woodpecker Steve Austin Woody Herman 
print_all_names(&lnames);Write print_all_names(), which should print all the names, one per line, in the format:
last, firstThe output should be sorted by last name, and if two people share the same last name, then they should be printed in order of first name.
for 0 ≤ x ≤ 3.
Answer the following questions:
Part A: Why do we restrict x to be ≤ 3?
Part B: In English, tell me what it means that CDF(1) = 1/9.
Part C: When we choose a random number according to this probability distribution, which is more likely:
Part D: Which of the following will set a to be a random number according to the probability distribution given by the above CDF. Assume that all variables used are doubles.
