Monday, June 21, 2010

Find the second element

June 22, 2010
How can we find second best player in a tennis tournament? In other words, how can we find second largest element in an unordered array? Assume that the array is having all distinct elements. What is the affect on algorithm if the array contains duplicates?
In most of the standard text books on algorithms, we can see solution to the above problem. There are various ways; each method has its specialty in different scenarios.
Hint: Keep track of players/elements. Explore various methods of book keeping.

No comments: