CS 2401 Quiz #8

Date: Tuesday, April 14, 2009.
Name: ____________________________________________

1. Show, step by step, how bubble sort and selection sort will sort a list consisting of elements 4, 14, 2, and 9. No code is needed.





















































2. How many comparisons are needed if we use sequential search to looks for an element in an array: in the first case? on average? Reminder in the sequential search, we first compare the desired object x with the first element a[0] of the array, then with the second element a[1], ..., until we either find the location of x or exhaust the array.