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).

Type your C solution code here:


This is a function problem. Write a C function as described. Do not write a complete program; just the function(s) above.

You must log in before you can solve this problem.


Log In

Need help?

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.

© Marty Stepp, all rights reserved.