Reputation: 3
There are two unsorted lists containing Integers, need to find the common largest integer in the list ?
I have an idea about this question, i taught first we need to find the largest element in the first list and then we need to apply linear search method for the second list using largest element of the first list. Is this logic correct....? If it's not can one help me with the logic for this question.
can any one help me out for this question please...
Upvotes: 0
Views: 104
Reputation: 18290
The problem with you first thought is that if the largest element in the first item does not occur in the second, you would never try another.
The most efficient way I can think of in a short time is this:
Upvotes: 1