Say, you have a set of weights.
and some operations on this set are readily available.
(1) int get_total_weight(Set * s) ; // return the total weight of the set s
(2) void remove_weights( Set * s, int k) ;
// remove all the elements from the set s,
whose individual weight equals 'k'
(3) int get_max_weight( Set * s) ;
// return the maximum of the weights
(4) add_to_set( Set * s, int k) ; // Add a new weight k to the set s
(5) int is_divided_to_two_equal_parts( Set *s);
// returns TRUE if and only if set of weights can be divided
into two parts such that both parts weigh the same
All you have to do is write a function
int is_subset( Set * s, int k);
which will return TRUE if and only if set s of weights has a subset
that weighs exactly k.
Some conditions ,
1) MUST call is_divided_to_two_equal_parts() , at least once.
2) MUST not have any loops , recursion or goto
3) MUST have less than 10 statements