a.mookambika
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
struct node* merge(struct node *l1, struct node *l2, struct node *l3){
l3 = null;
struct node * header = l3;
while(l1!=null || l2!=null){
if(l1-->info < l2-->info)
l3 = l1;
else
l3 = l2;
l1 = l1->next;
l2 = l2-->next;
l3 = l3-->next;
}
l3-->next = null;
return header;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
int check_nodes(struct node *tree)
{
static int depth1,depth2;
if((depth1==depth2!=0)&& tree==NULL)
return 0;
else
if(tree!=NULL) {
check_nodes(tree-->left,depth1++);
check_nodes(tree-->right,depth2++);
}
else if(depth1==depth2)
return 1;
else if(depth1!=depth2)
return 0;
}
Comment hidden because of low score. Click to expand.
0
of 0 vote
int factorial(int n){
if(n==0){
printf("\nfactorial of 0 = 1");
return 1;
}
else{
int fact = n * factorial(n-1);
printf("\nfactorial of %d = %d",n,fact);
return fact;
}
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
struct node {
- a.mookambika July 12, 2016int data;
struct node *data;
};
class revserselist{
struct node s;
public void reverse(){
static int count;
static struct node *current=s;
if(count==0){
for(struct node *temp=s;temp!=null;temp=temp->next,count++);
}
else if (count>1) {
for(struct node *temp=s;temp->next->next!=null;temp=temp->next);
struct node *swap = temp->next;
temp->next=current;
current=swap;
if(swap->next==null){
s=temp; //change of header
count--;
current=current->next;
reverse();
}
}
public static void main(String args[]){
reverselist r;
r.reverse();
}
}