<T> int sameCount(Collection<T> a, Collection<T> b)
In the Appearances class, the static Appearances.sameCount() method takes in two c ollections -- A and B --containing a generic <T> element type. Assume that the T elements implement equals() and hashCode() correctly, and so may be compared and hashed. The elements are in no particular order. Every element in A appears in A one or more times, using .equals() to compare elements for equality (the standard definition of equals() for java collections). Likewise every element in B appears one or more times. sameCount() counts the number of elements that appear in both collections the same number of times.
For example, with the collections {"a", "b", "a", "b", "c"} and {"c", "a", "a", "d", "b", "b", "b"} it returns 2, since the "a" and the "c" appear the same number of times in both collections. Use hashing to compute the
number of appearances efficiently.
Can anyone help me ?
Thank you so much
This appears to be for Java. Even if this were for C++, what help do you want from us in specific?
Can you write down the code for me?
OK, I wrote it down on a piece of paper. I liked the pretty colors it made when I burned it.
Topic archived. No new replies allowed.