Write an efficient C program to count the number of bits set in an unsigned integer. i/p o/p ==== === 0(00) 0 1(01) 1 2(10) 1 3(11) 2 ..... ... Counting Bits View SlideShare presentation or Upload your own. (tags: algorithms

Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program. (NOTE: The key is, think UNIX). Suppose, the program is 1.c Then, while compiling $ cc -o 1 1.c int main() { printf("Hello World

"); } ^D $ ./1 Hello World $

Given a string s1 and a string s2, write a snippet to say whether s2 is a rotation of s1 using only one call to strstr routine? (eg given s1 = ABCD and s2 = CDAB, return true, given s1 = ABCD, and s2 = ACBD , return false)