given subsets A and B of a set with n elements, use bit strings to find A, A U B, A - B, and A + BHow do you use bit strings in java programming?
//Collection.addAll() - union
//Collection.retainAll() - intersection
//add bits to a collection object
String binStr = new Integer(8).toBinaryString;
char[] bits = binStr.toCharArray();
Collection c = new ArrayList();
for(int i = 0; i %26lt; bits.length; i++)
{c.add(new Character(bits[i]));}
/*
make two collection with different elements as shown above then invoke the two aforementioned methods on them.
*/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment