The list may contain duplicates the original list

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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

{[ snackBarMessage ]}

Ask a homework question - tutors are online