CSE 1302C – Test 2 Directions: You have 90 minutes to complete this exam. It is a pencil and paper only exam. 3/26/13 Question 1 (25 pts): What is the output of the following code? I would recommend drawing the stack. static int Mystery(int n, int s) { Console.WriteLine("Values are " + n + " " + s); s+=2; n--; if (n <= 1) { return n; } else { return s + n + Mystery(n, s); } } static void Main(string[] args) { Console.WriteLine(Mystery(5, 3)); } Question 2 (40 pts): Using “Big-Oh” notation, show how long would it take to do the following operations in the most efficient way. Assume you are working with integers. If data is sorted, it is in ascending (non-decreasing) order. Write any assumptions that you may have (i.e. any extra variables you may have). Since there are two parts to each question, you can write your answer as the time it takes to do each part (i.e. “step one takes…” and “step two takes”). If in doubt, you may also consider explaining your reasoning. Find the minimum element in an unsorted array and put it into a sorted linked list. Find the minimum element in a sorted array and put it into an unsorted linked list. Find the minimum element in a Binary Search Tree and put it into an unsorted array. Search for an element in a sorted array and put it into a binary search tree. Question 3 (35 pts): Assume you have a new job with the National Security Agency. You’re on the criminal investigation unit and agents have just recovered a file called “dirt.txt” containing the names of wanted criminals, with one name per line. Your task, if you choose to accept it, is to write a program that asks the user for a name to search for (using Console.ReadLine()) and determines if the name of that person is in the wanted list. The program should print out either “person found” or “person not found”. This test will self destruct.