monika.agarwal712
BAN USERmerge(node h1*,node *h2)
{ node *ptr1=h1,*ptr2=h2,*prev1=null,*temp;
if(h1==null)
return h2;
while(*ptr1!=null&&ptr2!=null)
{
if(ptr1>data<=ptr2>data)
{
prev1=ptr1;
ptr1=ptr1>next;
if(ptr1>data==ptr2>data)
{ temp=ptr2;
ptr2=ptr2>next;
free(temp);
}
}
else
{
temp=ptr2>next;
ptr2>next=ptr1;
if(prev1==null)
{
h1=ptr2;
}
else
prev1>next=ptr2;
ptr2=temp;
}
}
if(h1==null && h2==null)
return null;
else if(ptr1==null)
prev1>next=ptr2;
return h1;
else if(ptr2==null)
return h1;

monika.agarwal712
January 24, 2013 flatten(node *ptr)
{
if(ptr==null)return;
node * alist=flatten(ptr>left);
node *blist =flatten(ptr>right);
node * tmp=alist;
while(tmp>next!=null)tmp=tmp>next;
tmp>next=ptr;
tmp=ptr;
tmp>next=blist;
return alist;
}
this works correctly
 monika.agarwal712 January 24, 2013// call function by (root, null) as for parent node its not having any sibling
sibling(node* root, node* sib)
{ if(root==null)
return;
root>sibling=sib;
sibling(root>left,root>right);
sibling(root>right,null)
//as right child of all nodes do not have sibling in binary tree
}

monika.agarwal712
January 24, 2013 reverse(node* ptr)
{
if(ptr==null)
return;
else{
reverse(ptr>left);
reverse(ptr>right);
node* t= ptr>left;
ptr>left=ptr>right;
ptr>right=t;
return;
}
}

monika.agarwal712
January 24, 2013 guys what are u doing its so simple maintain numbers in a link list and go through the list maintain 2 pointers initially both are pointing to start when you find an negative number stop the first pointer and increment the second pointer for next +ve number and as in link list you just have to change some pointers insert that positive elment before the negative number in this case al +ve will be in front in the same order and ve in end in same order
 monika.agarwal712 January 05, 2013bracket(int n1,int n2,char brkt)/*here when first time function is called brkt contains '{' and n1 is n1 and n2 is n*/
{
if(n1==0 and n2==0)
return;
else if(n1==0&&brkt=='{')
return;
else {
print(brkt);
return( bracket(n11,n2,'{')bracket(n1,n21,'}'));
}
}
anonymous this is the exactly right solutions and what it thought too
 monika.agarwal712 January 05, 2013I think it should work
printf_path(node * ptr, curr_sum,Value)
{
if(curr_sum==Value)
{
//found a path
}
else
{
if(ptr>left>data+curr_sum<=Value)/*continuing adding sum from left*/
print_path(ptr>left,ptr>left>data+curr_sum,Value);
if(ptr>left>data<=Value) /*new path starting from the current node*/
print_path(ptr>left,ptr>left>data,Value);
if(ptr>right>data+curr_sum<=Value) /*continuing adding sum from right*/
print_path(ptr>right,ptr>right>data+curr_sum,Value);
if(ptr>right>data+curr_sum<=Value)
/*new path starting from current node*/
print_path(ptr>right,ptr>right>data,Value);
}
}

monika.agarwal712
January 05, 2013
your code does not works if 1,2,4,8,8,10 && 1,6,7,7,7,10
 monika.agarwal712 January 25, 2013then after swaping 7 wid 8 it wl brek the order like 1,2,4,8,8,7 now it wl compare wid 7 and wont put 8 in 2nd array so there is a modified solution
1.combine both array now take 3 pointers 2 pointing at the end of smaller array (by comparing last element) and 1 pointing at larger array
2. compare elements from back and swap if larger elemetnt is found in smaller array now wen u keep on swaping in samaller array 2 list will get generated one swapper and one original now first point will point at end of original one it wl be largest elemnt of original one and 2nd pointer will point at the end of swapped one it wl be largest elemnt of swap list on each comapre wid 2 elemnts of first list this will give perfect soolution