[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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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;ib;i++)
r=r+a;
}
return r;
}

On Wed, Jun 27, 2012 at 10:46 AM, Prateek Jain prateek10011...@gmail.comwrote:

 main(a,b,m)
 02{
 03while (~scanf(%d%d,a,b))
 04{
 05  m=0;
 06  while (a)
 07  {
 08 if (a1)
 09   m+=b;
 10 a=1;
 11 b=1;
 12  }
 13  printf(%d\n,m);
 14}
 15}

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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 harry.rat...@gmail.com 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.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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
gobind@gmail.comwrote:

 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...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



[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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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
gobind@gmail.comwrote:

 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



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 (a1)
09   m+=b;
10a=1;
11b=1;
12  }
13  printf(%d\n,m);
14}
15}

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.