logo CodeStepByStep logo

is_single

Author: Cynthia Lee (on 2016/11/03)

This function is given three bit vectors in form as returned by previous problem called make_set (each bit vector is an unsigned short). These represent the set of digits already used in the row, column, and block for a given cell. Returns true if already used digits admit one and only one possible digit for this cell and false otherwise.

Precondition: parameters represent well-formed bit vector sets, as returned by make_set. Implementation can assume client is responsible for meeting precondition.

For example, if the input is 168 (binary 0000000010101000, 6 (binary 0000000000000110, 80 (binary 0000000001010000), then is single returns true, because bit position 9 is the only bit position that is not a 1 in any of the three input bit vectors (counting only bit positions 1-9).

Function: Write a C function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.