Re: [algogeeks] Question asked in Tachyon interview

2012-06-27 Thread Amitesh Singh
It can be done using Queues in O(n). -- Amitesh On Wed, Jun 27, 2012 at 3:07 PM, hary rathor wrote: > apply BFS > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. >

Re: [algogeeks] Question asked in Tachyon interview

2012-06-27 Thread atul anand
queue q; q.enqueue(root); while q is not empty do print :temp=dequeue(); if(temp->left) enqueue(temp->left) if(temp->right) enqueue(temp->right); end while; On Wed, Jun 27, 2012 at 2:59 PM, Gobind Kumar Hembram wrote: > Write C code to implement level orde

Re: [algogeeks] Question asked in Tachyon interview

2012-06-27 Thread megha agrawal
int mul(int a, int b) { int r=0; if (a==0|| b==0) r=0; else { for(int i=0;iwrote: > main(a,b,m) > 02{ > 03while (~scanf("%d%d",&a,&b)) > 04{ > 05 m=0; > 06 while (a) > 07 { > 08 if (a&1) > 09 m+=b; > 10 a>>=1; >

Re: [algogeeks] Question asked in Tachyon interview

2012-06-27 Thread hary rathor
apply BFS -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this gro

[algogeeks] Question asked in Tachyon interview

2012-06-27 Thread Gobind Kumar Hembram
Write C code to implement level order traversal of a tree. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@g

Re: [algogeeks] Question asked in Tachyon interview

2012-06-26 Thread Prateek Jain
main(a,b,m) 02{ 03while (~scanf("%d%d",&a,&b)) 04{ 05 m=0; 06 while (a) 07 { 08if (a&1) 09 m+=b; 10a>>=1; 11b<<=1; 12 } 13 printf("%d\n",m); 14} 15} -- You received this mess

Re: [algogeeks] Question asked in Tachyon interview

2012-06-26 Thread atul anand
search for Ethiopian Multiplication On Wed, Jun 27, 2012 at 9:45 AM, Gobind Kumar Hembram wrote: > How to multiply two numbers without using * operator? > Hint:Use bit operators > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To pos

[algogeeks] Question asked in Tachyon interview

2012-06-26 Thread Gobind Kumar Hembram
How to multiply two numbers without using * operator? Hint:Use bit operators -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algog