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. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!