rohan
BAN USER#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char a[]="hello", b[]="oheee";
if(strlen(a)!=strlen(b))
{
cout<<"\nNO\n";
return 0;
}
int count[53];
for(int i=0;i<52;++i)
count[i]=0;
int k,i;
k=strlen(a);
i=0;
while(i<k)
{
count[(int)a[i]-65]+=1;
count[(int)b[i]-65]-=1;
i++;
}
i=0;
while(i<52)
{
if(count[i]!=0)
{
cout<<"\nNO\n";
return 0;
}
i++;
}
cout<<"\n YeS\n";
return 0;
}
#include<iostream>
#include<string.h>
using namespace std;
void add(char *a, char *b, char *c)
{
int i, cc=0,m=strlen(a)>strlen(b)?strlen(a):strlen(b),k,s;
k=s=strlen(a)<strlen(b)?strlen(a):strlen(b);
k-=1;m--;s--;
if(strlen(a)>strlen(b)?1:0)
{
for(i=m;i>=m-s;--i,k--)
{
c[i]=((int)(a[i])+(int)(b[k])-48*2+cc)%10+48;
cc=((int)(a[i])+(int)(b[k])-48*2)>9?1:0;
}
for(;i>=0;--i)
{
c[i]=((int)a[i]+cc-48)%10+48;
cc=((int)(a[i])+cc-48)>9?1:0;
}
}
else
{
for(i=m;i>=m-s;--i,k--)
{
c[i]=((int)(a[k])+(int)(b[i])-48*2+cc)%10+48;
cc=((int)(a[k])+(int)(b[i])-48*2)>9?1:0;
}
for(;i>=0;--i)
{
c[i]=((int)b[i]+cc-48)%10+48;
cc=((int)(b[i])+cc-48)>9?1:0;
}
}
}
main()
{
char a[]="111000",b[]="110001",*c;
c= new char[strlen(a)>strlen(b)?strlen(a):strlen(b)];
add(a,b,c);
cout<<c<<endl;
}
RepIn 2008 I was licensing race cars in Los Angeles, CA. What gets me going now is promoting husband vashikaran ...
This problem can be done in an easier way...
First, travel through the list and store the elements in an array, then that array is also sorted in ascending order.
Second, define a function as follows (pseudo-code) :-
where tree_insert is name of the function for inserting a value into the binary tree
- rohan August 27, 2012