hw4-sol - Sheet1 Page 1 SetAsBitVector operator %...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sheet1 Page 1 SetAsBitVector operator % (SetAsBitVector const& s, SetAsBitVector const& t) { if(s.universeSize != t.universeSize) throw invalid_argument("mismatched sets") SetAsBitVector result(s.universeSize) for(unsigned int i=0 result.vector[i] = (s.vector[i] | t.vector[i]) & ~(s.vector[i] & t.vector[i]) return result } unsigned int packBits(unsigned int one, unsigned int two, unsigned int three, unsigned int four) { unsigned int result = 0 result = one<<24 result |= two<<16 result |= three<<8 result |= four return ~result } This implementation provides an outline for one method of finding the subsets. In particular, the getCombination function should return a particular combination from the given input. The shown code finds any particular subset by position, and recurs. This should be repeated for all combinations of subsets. //returns hth combination from the set. returns a pair. The first element in the pair //is an array of integers having the combination of index orderings (eg. {1, 2, 3}, {2, 1, 3}, {3, 1, 2}, etc.).//is an array of integers having the combination of index orderings (eg....
View Full Document

This note was uploaded on 04/11/2008 for the course EECS 281 taught by Professor Jag during the Winter '08 term at University of Michigan.

Page1 / 8

hw4-sol - Sheet1 Page 1 SetAsBitVector operator %...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online