It is linear, as the only inner loop repeats at most n times, and performs only constant time operations. More specifically 1. B1 = a1 2.
B2 = a2 3. If b1 > b2 then t=b1; b1=b2; b2=t 4. B3 = a3 5.
If b2 > b3 then t=b2; b2=b3; b3=t 6. If b1 > b2 then t=b1; b1=b2; b2=t 7. For (i = 4; I b3 then t=b2; b2=b3; b3=t 11.
| | if b1 > b2 then t=b1; b1=b2; b2=t 12. Return b3 Lines 1-6 are executed only once and should be constant time. In the context of a single run through the for loop, Lines 8-11 are executed only once, and are all constant time operations; which are then repeated ~n-3 times.
This is O(n), it is always good to look at what the input is, and see what changes if you were to add another element to the array in this case. You will find that you will have to scan over the array to find the 3rd smallest element in the array.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.