AD1

Saturday 17 June 2017

C program to left rotate an array

Write a program to left rotate an array by n position
Example
Input
Input 10 elements in array: 1 2 3 4 5 6 7 8 9 10
Input number of times to rotate: 3
Output
Array after left rotation: 4 5 6 7 8 9 10 1 2 3
Solution

Count Set bits in an array of integers

assume you have an array of 5 integers and you want to count the numbers of set bits in all array elements , write a function to do that

Solution


Circular Bit Shift

Write two functions RL(data,n) which performs circular left shift on variable data by n bits , RR(data,n) which performs circular right shift on variable data by n bits
note: data is 1 byte variable

refer to this video to know more about circular bit shifts




Solution

Saturday 3 June 2017