Implement the following functions in C ONLY using
**bitwise operators**
like &, |, ^, ~, <<, >>,
as well as +, -, <, >. (Not necessarily
all of them.) Arithmetic operators /, %,
and * are not allowed.

- int add_element(int x): function adds an element with index x to set J.
- int remove_element(int x): function removes an element with index x from set J.
- int contains_element(int x): function checks if an element with index x is contained in set J.

Community Answer

The C programs in this section which checks whether the given integer has an alternate pattern. It also focuses on rounding the floor of an integer to the next lower power of 2 with and without using bitwise operations, displaying the range of basic data types and the program which uses a function to return the Most Significant Bit position of an unsigned integer.   Program/Source Code #include <stdio.h> #include <stdlib.h> int main () { tint num = 0, n = 0, i =0; tint count = 0; tprintf("Enter the number: "); tscanf ("%d", &num); tn = num; t// first lets count the number of bits twhile (n) t{ ttcount ++; ttn = n >> 1; t} tprintf ("n COUNT : %d", count);   t// now check for alternative tfor (i = 0; i <= count - 2; i++) t{ ttif (((num >> i) & 1) == ((num >> (i+2)) & 1)) tt{ tttcontinue; tt} ttelse tt{ tttprintf ("nFALSE : ALTERNATIVE PATTERN DOES NOT EXISTn"); tttexit (0); tt}   t} tprintf ("nTRUE : ALTERNATIVE PATTERN DOES EXISTn"); return 0; } This C ... See the full answer