Assume you have the following entries
{"C B A A B C", "F D E", "I G H I", "B G C E F"}
what should edit return? Enter your answer in your README.
sToSet that converts a String
of the form in the assignment ("B G C E F") to a
Set. In your code, you should create and
return a
TreeSet, rather than a Set. Why
does that work?
collToS that converts
a Collection to a String of the form above. How would
you call collToS on a TreeSet?
numInCommon so that it returns the number of elements in
common between two sets, a and b
union so that it returns the union of two sets, , a and b.
a or b.
main method to test out your
sToSet, collToS, numInCommon, and union
methods.
edit and
complete the APT. You can use the the pseudocode below as a guide.
Convert entry to an ArrayList of sorted Sets: entrySet
Keep merging entries until nothing is merged
Let n be the number of elements in entrySet
For every pair (i,j) where 0 ≤ i,j < n and i < j
if entrySet[i] and entrySet[j] have ≥ 2 in common
merge entrySet[i] and entrySet[j]
Convert list of Sets to an array of Strings
Sort the entries in alphabetical order