anil1in7
BAN USER
Comments (3)
Reputation 10
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
Code to generate all 2pwd N combinations. Using bit operations.
#include<stdio.h>
int main()
{
int b[] = {1,2,3,4};
int i,a=15;
for(i=0;i<16;i++){
int k=0,sum=0,j =i;
do{
printf("%d",j&1);
sum=sum+b[k]-2*(j&1)*b[k];
j=j>>1;
k++;
}while(k<4) ;
printf("\n");
printf("%d\n",sum);
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
preorder Traversal{
- anil1in7 January 18, 2014IF(parent == zero && non-zerochild)
swap;
preorder left;
preorder right;
}