110k views
3 votes
Suppose you are consulting for a bank that's concerned about fraud detection, and they come to you with the following problem. They have a collection of n bank cards that they've confiscated, suspecting them of being used in fraud. Each bank card is a small plastic object, containing a magnetic stripe with some encrypted data, and it corresponds to a unique account in the bank. Each account can have many bank cards corresponding to it, and we'll say that two bank cards are equivalent is they correspond to the same account. It's very difficult to read the account number off a bank card directly, but the bank has a high-tech "equivalence tester" that takes two bank cards and, after performing some computations, determines whether they are equivalent. Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester. Show how to decide the answer to their question with only O(n log n) invocations of the equivalence tester.

User Safl
by
4.0k points

2 Answers

4 votes

Final answer:

The question pertains to using a divide-and-conquer algorithm to identify dominant bank cards suspected of fraud using only O(n log n) invocations of an equivalence tester, similar to the merge sort complexity.

Step-by-step explanation:

The student's question relates to the field of algorithms and fraud detection in a bank context, specifically how to determine if there is a set of more than n/2 equivalent bank cards using an equivalence tester with only O(n log n) invocations.

To solve this, consider using a divide-and-conquer approach reminiscent of the merge sort algorithm. Essentially, divide the collection into two halves and recursively apply the same strategy to find the dominant card (if any) in each half. After that, use the equivalence tester to compare the dominant cards found in each half to identify if they are the same. Continue with this process, counting how many times the dominant card appears in the entire collection. This will require only O(n log n) comparisons as it follows the same complexity as the merge sort algorithm.

An example related to the student's question is drawing cards from a deck and determining probability or sampling methods. While not directly applicable to the problem at hand, the concept of sampling without replacement could be loosely analogous to testing pairs of cards without repeating comparisons.

User Jernej Novak
by
3.8k points
5 votes

Answer:

Step-by-step explanation:

( n cards are there initially )

we pick out the first card in random it takes n-1 comparisons to figure out

its Equivalence card - n-1 steps

Two cards have been eliminated ( this leaves us with 2 and n-2 cards)

we pick out the 2nd card in random it takes n-3 comparisons to figure out

its Equivalence card - n-3 steps

we continue to do this.. till all cards are exhausted ( leaves us with 2

and n-4 cards again)

the last comparison will

have

- n-(n-3)

the sum of all these steps - (n-1) + (n-3) + (n-5) + .........+

(n-(n-3))

if you draw this in the form of a tree.

n - n

2

n-2 - n

2

n-4 - n-2

2

n-6 - n-4

2

n-8 - n- 6

the height of the tree will be log n , sum @ each level is at most n

User HarshvardhanSharma
by
4.4k points