Question: a. Consider the problem of finding the third smallest element of a given list of numbers. For example, the third smallest in [1, 99, 7,
a. Consider the problem of finding the third smallest element of a given list of numbers. For example, the third smallest in [1, 99, 7, -3, 3, 10, 12] is 3. In lecture and homework, you have seen and used the code below (except for the name "thirdSmallest" used for the second function). Modify/finish the indicated lines of thirdSmallest so that it correctly returns the third smallest element. The modified algorithm must also have a running time bound better than O(n^2). # return index of min item in L[startIndex:] # assumes startIndex
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
