{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

smid - Design and Analysis of Algorithms — CSE 101 Sample...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

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 ) worst-case 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

{[ snackBarMessage ]}

Ask a homework question - tutors are online