This preview shows page 1. Sign up to view the full content.
Unformatted text preview: duces 2 when x = 1, 2, or 3, and produces 9 when x = 4 or 5. Your solution must use the following approach: • Partition L into three sublists, using the last value in L as a "pivot": o Entries in L that are less than the pivot, o Entries in L that are equal to the pivot, and o Entries in L that are greater than the pivot. • Determine which sublist contains the kth smallest entry, and continue the recursion on that sublist only (if necessary). Note that you may need to update the value of k on your recursive call. You will lose all correctness marks if you do not use this approach. In particular, you cannot use any sorting t...
View
Full
Document
 Winter '14
 Recursion

Click to edit the document details