Unformatted text preview: Design and Analysis of Algorithms — CSE 101 Sample Mid–term Questions 1. Write a recursive algorithm that sorts a list of n items by dividing them into three sublists of n/ 3 items, sorting each sublist recursively and merging the three sorted sublists. Analyze your algorithm, and determine its time complexity. Make sure that you formulate the appropriate recurrence relation and present its solution. Present a high level description of the algorithm followed by pseudo code. Don’t write detailed code. 2. Let S be an unsorted array of n distinct integers. Give an algorithm that finds the pair of elements x , y in the array S such that x 6 = y and  x y  is minimized. Your algorithm must run in O ( n log n ) worstcase time. 3. You are given all of the book checkout cards used in the campus library duing the past year. Design an efficient algorithm for determining how many distinct people checked out at least one book. For each book, there is a checkout card bearing the ID of the book andat least one book....
View
Full Document
 Winter '08
 staff
 Algorithms, Graph Theory, Sort, Big O notation, Analysis of algorithms

Click to edit the document details