Answer :
To solve the problem of finding a set of at least n/2 logins that were from the same account using the provided equivalence tester in θ(nlog(n)) invocations, we can employ a modified version of the divide-and-conquer approach.
The algorithm can be summarized as follows:
Divide the list of login instances into two equal-sized sublists.
Recursively apply the algorithm on each sublist to find the potential sets of n/2 logins that were from the same account.
Combine the results from the two sublists, checking if there exists a set of n/2 logins that appear in both sublists.
If such a set is found, return it as the result.
If no set is found, return an empty result.
In the explanation, we start by dividing the initial list into two sublists of equal size. Then, we recursively apply the algorithm on each sublist to find potential sets of n/2 logins that were from the same account. This step is repeated until we reach the base case of sublists containing only one login instance.
Next, we combine the results from the two sublists. To do this, we check if there exists a set of n/2 logins that appear in both sublists. This can be done by comparing each login from one sublist with every login from the other sublist using the provided equivalence tester. Since there are n/2 logins in each sublist, the total number of invocations of the equivalence tester is n/2 * n/2 = n^2/4.
If we find a set of n/2 logins that appear in both sublists, we can confidently conclude that there exists a set of at least n/2 logins that were from the same account. In this case, we return the set as the result.
If no such set is found after combining the sublists, it implies that there is no set of at least n/2 logins from the same account. In this case, we return an empty result.
Overall, the algorithm requires θ(nlog(n)) invocations of the equivalence tester since we divide the list into two equal-sized sublists in each recursive step, resulting in a logarithmic number of divisions.
Learn more about divide-and-conquer approach here:
https://brainly.com/question/33171665
#SPJ11