These are a sample of questions that might appear on Exam 1. Define the following terms: (3) backtracking (2) base case (for recursion) (2) recursive case (5) big O (2) best case analysis (2) average case analysis (2) worst case analysis Give code for: (10) Sequential search of an array (10) Sequential search of a sorted array (10) Binary search of a sorted array (10) Selection sort (10) Insertion sort (15) Merge of two adjacent segments of an array (10) Mergesort given a predefined merge routine (10) Write a function that takes an array of characters S of length N and returns 1 if that array contains a palindrome and 0 otherwise. A palindrome is a sequence of characters that is the same written backwards. (10) Write a recursive solution to the previous problem. (10) Write a recursive function that sums up the squares of all the numbers from 1 to N (i.e., SumSqrs(N) returns 1^2 + 2^2 + 3^2 + ... + N^2). (15) Given a 2D character array A: 0 1 2 3 0 e e X X 1 X e e e 2 X e X X 3 e e e X and the function Visit: void Visit(char A[][4], int r, int c) { if (A[r][c] == 'e') { A[r][c] = '.'; printf("<%d,%d> ",r,c); if (r > 0) Visit(A,r-1,c); /* 1 */ if (c > 0) Visit(A,r,c-1); /* 2 */ if (r < 3) Visit(A,r+1,c); /* 3 */ if (c < 3) Visit(A,r,c+1); /* 4 */ } } the program will print: <0,0> <0,1> <1,1> <2,1> <3,1> <3,0> <3,2> <1,2> <1,3> if we call Visit(A,0,0) how could you reorder the statements labeled /* 1 */ to /* 4 */ to print: <1,1> <1,2> <1,3> <2,1> <3,1> <3,0> <3,2> <0,1> <0,0> if we call Visit(A,1,1)? How about: <1,1> <2,1> <3,1> <3,2> <3,0> <0,1> <0,0> <1,2> <1,3> (2 each) Give the Big-O notation (the growth-rate function) for each of the following formulas: 2 N + 3N + 4NlogN + 5/N 2 3 N 5N + 25N + 3N + 4 2 2 3N logN + 5N + NlogN + 2N (15) Give a situation where each of the sorts discussed in class (insertion, selection, and merge) is optimal. You should include a discussion of the performance characteristics of the sorting algorithm that backs up your answer.