CS 2110 Midterm: CS 2110 Cornell 2012 Fall Examsp2solcs211sp05

23 views12 pages
31 Jan 2019
Course
Professor

Document Summary

There are 8 questions on 11 numbered pages. Check now that you have all the pages. Use the back of the pages for workspace. The exam is closed book and closed notes. Page 1 of 11: (15 points) write a recursive binary search method to nd an object v in a sorted array a of comparables. The procedure should return true if object v is found in the array, and false if it is not found. //search interval is inclusive of lo, exclusive of hi. //method assumes that 0 <= lo <= hi <= a. length. 24: (10 points) one advantage of quicksort is that it sorts in place. Manually perform quicksort on the following array of integers (sort in increasing order), using the. Rst element of each subarray as the pivot. In the spaces provided show the values in the array as quicksort proceeds down each level.