[algogeeks] Re: Amazon Interview Question

2012-07-13 Thread jatin sethi
1)Find product of the array and store it in say prod o(n) and o(1) 2)now traverse the array and check if static int i; tag: while(i Given an array of integers where some numbers repeat once, some numbers > repeat twice and only one number repeats thrice, how do you find the number > t

[algogeeks] Re: how to print "tata" from "tatapower" using only strcat and strcpy???

2012-07-11 Thread jatin sethi
char str[5] , *p , str1[]="tatapower; p=str1 while(*p) { if(*p=='t'||*p=='a') if(str==NULL) strcpy(str,*p); else strcat(str,*p); p++; } On Tuesday, 10 July 2012 16:15:16 UTC+5:30, amrit harry wrote: > > -- You received this message because you are subscribed to the Google Groups "

Re: [algogeeks] balanced tree

2012-07-10 Thread jatin sethi
for complete tree tree at last level can have left child and no right child , thus condition shd be somewhat like this... if(node[right]==NULL&&node[left]==NULL) return true; if(node[right]!=NULL) // if the node Rchild!=NULL then there shd be Lchild present. if(node[left]==NULL) ret