Answer:
A Simple Solution is to sort the array in increasing order. The first two elements in sorted array would be two smallest elements. Time complexity of this solution is O(n Log n).
A Better Solution is to scan the array twice. In first traversal find the minimum element. Let this element be x. In second traversal, find the smallest element greater than x. Time complexity of this solution is O(n).
The above solution requires two traversals of input array.
An Efficient Solution can find the minimum two elements in one traversal. Below is complete algorithm.
Algorithm:
Explanation:
Its true just took the test.
Auto insurance companies offer discounts if you are good student, or full time student (which includes your gpa).
grants and scholarships are rewarded by good grades and succession of essay writing.
students will get kicked off their athletic team if their GPA is too low.
That singles out comparing yourself to your friends, which should be obvious that this one's excluded. ☺
Explanation:
A sociologist might look at the amount of fresh fruits and vegetables available in a neighborhood trying to understand social issues that affect health. If you can find and afford to live in a neighborhood where you can shop for fresh fruits and vegetables more often, near home, you may be more likely to consume those foods more regularly.
Answer:
A. may not get an increase in the amount of one's investment.
Explanation
Have a great day! :) (and all the other one's are good things that can happen to you)