[algogeeks] Question on algo

2015-10-05 Thread *$*
Little Black Panda is mad about XOR operation. Presently he has gone mad
and he won't stop performing XOR operation on various numbers.
Given an array of N numbers, for each subset of the array Little Panda
performs MAXOR operation for the subset. MAXOR operation means that he
finds XOR of all elements in that subset (if the subset is [1,2,3] then
MAXOR is 1^2^3=0) . Little Panda is now exhausted and wants to do something
else. Little Panda wants to pick any two subsets the MAXOR of whose are
same. Little Panda needs to find the number of selections that he can make.
He is very very weak in programming so he wants the answer from you. Please
help little panda in finding out his query.
Since the output can be very large output it modulo 17.

Input Format
The first line contains N i.e. the length of the array.
N lines follow, each containing a non-negative integer.

Output Format
Output Little Panda's Query in a single line.

Constraints
1 <= N <= 10
0 <= A[i] <= 100
(where A[i] denotes the value of array element)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Re: [algogeeks] Question

2013-03-12 Thread Sairam

No, it is only O(n), but space will be order of O(maximum element in the 
range)

Because only one loop to go through all the intervals and get the maximum.

Then allocate space for that much, after that again go through intervals 
and increment the corresponding value.

Then after that finding maximum can be done in again O(n).

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Question

2013-03-01 Thread Abioy Sun
segment tree

2013/2/18 bharat b bagana.bharatku...@gmail.com:
 @ richard : u'r algo takes O(n^2) time .. try to write code ... u'll come to
 know..


 On Sun, Feb 17, 2013 at 1:13 PM, Richard Reed exp.r...@gmail.com wrote:

 If the times are discrete, you can create an array with the size of
 discrete time (0 to whatever, adjusted). For each time slot, add 1 to each
 index of the array that corresponds to a time range. Then iterate through
 the list to find the highest time tally. This is an O(n) solution.


 On Sat, Feb 16, 2013 at 11:32 PM, shady sinv...@gmail.com wrote:

 Given a number of time slots – start time and end time,“a b”, find any
 specific time with the maximum number of overlapping.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Question

2013-02-18 Thread bharat b
@ richard : u'r algo takes O(n^2) time .. try to write code ... u'll come
to know..


On Sun, Feb 17, 2013 at 1:13 PM, Richard Reed exp.r...@gmail.com wrote:

 If the times are discrete, you can create an array with the size of
 discrete time (0 to whatever, adjusted). For each time slot, add 1 to each
 index of the array that corresponds to a time range. Then iterate through
 the list to find the highest time tally. This is an O(n) solution.


 On Sat, Feb 16, 2013 at 11:32 PM, shady sinv...@gmail.com wrote:

 Given a number of time slots – start time and end time,“a b”, find any
 specific time with the maximum number of overlapping.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Question

2013-02-17 Thread atul anand
related to this problem, link given below :-

http://groups.google.com/group/algogeeks/browse_thread/thread/7cfb0a6f7d121d92/0adc692fad1bab40?hl=enlnk=gstq=DP+equation+for+interval+problem#0adc692fad1bab40

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] Question

2013-02-17 Thread Richard Reed
If the times are discrete, you can create an array with the size of
discrete time (0 to whatever, adjusted). For each time slot, add 1 to each
index of the array that corresponds to a time range. Then iterate through
the list to find the highest time tally. This is an O(n) solution.

On Sat, Feb 16, 2013 at 11:32 PM, shady sinv...@gmail.com wrote:

 Given a number of time slots – start time and end time,“a b”, find any
 specific time with the maximum number of overlapping.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to algogeeks+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] Question

2013-02-16 Thread shady
Given a number of time slots – start time and end time,“a b”, find any
specific time with the maximum number of overlapping.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] Question on checking divisibility of binomial coefficients of a number by a prime number

2012-08-26 Thread Ankit Singh
In mathematics, *binomial coefficients* are a family of positive integers 
that occur as coefficients in the binomial theorem. [image: \tbinom nk]denotes 
the number of ways of choosing k objects from n different objects.

However when n and k are too large, we often save them after modulo 
operation by a prime number P. Please calculate how many binomial 
coefficients of n become to 0 after modulo by P.

*Input*

The first of input is an integer T , the number of test cases.

Each of the following T lines contains 2 integers, n and prime P.

*Output*

For each test case, output a line contains the number of [image: \tbinom nk]s 
(0=k=n) each of which after modulo operation by P is 0.

*Sample Input*

3

2 2

3 2

4 3

*Sample Output*

1

0

1

*Constraints:*

T is less than 100

n is less than 10500.
P is less than 109.
 
 
 
 
I Have applied a logic that if any binomial coefficient can be written as 
n!/(n-k)!k!  so if (n/p)((n-k)/p+k/p) so that coefficient will be 
divisiblr by prime number p. but the problem is range of is so large so if 
i give an input of that much range it will take more then 15 min . although 
complexity of my code is O(n/2) but my program keep on running because of 
very high range of input. Can anyone help me in this please??
 
Thank you

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/ow00hepNjeMJ.
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

2012-08-22 Thread Arman Kamal
Convert the integer to a binary string.  From the right (that is least
significant bit), find the first occurence of 01 in the string. For
example.. if the string is *00110  **01 **11100*, notice the isolated part,
that is what you have to find.  Then simply flip the 01 to 10.. like *00110*
*10**11100.*  And then move all the 1's that you skipped to the right..
like *00110**10**00111*

-- 
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

2012-08-21 Thread megha agrawal
   Can anyone suggest solution for this problem?


   You are given an unsigned integer.Write a function to print the next
   number which will be having same number of 1 bits present in given num.
   eg) 6(110) to 9(1001)

-- 
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

2012-08-21 Thread Arun Kindra
a) count total no of bit set in given no
b) increment the given no by one and count the no of bit set in it if it
equal to the above count then return else increment the no till u get the
count equals the above one.

-- 
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 Amazon Online Test

2012-06-30 Thread himanshu kansal
i think this algo will do...
reverse the given prefix expression
while(!nd of input)
{ if it is operand
push in a stack
  if its an operator
  {  op1=pop(stack);
 op2=pop(stack);
 push (op1 op2 operator) on to stack;
  }
}
On Sat, Jun 30, 2012 at 1:56 AM, Bhaskar Kushwaha 
bhaskar.kushwaha2...@gmail.com wrote:

 example
 -+53+2/36
 step 1: 63/2+35+-
 step 2: 36/2+53+-

 On Sat, Jun 30, 2012 at 1:55 AM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 reverse the prefix notation and then reverse each continuous occurence of
 operands


 On Sat, Jun 30, 2012 at 12:50 AM, Abhishek Sharma 
 abhi120...@gmail.comwrote:

 convert prefix to infix,then convert infix to postfix.Now, to convert
 prefix to infix, push numbers in one stack and operators in other.Then use
 thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
  algo
 to perform this.Then do the same for infix to postfix.It works with simple
 operators,but difficult to implement with parenthesis.


 On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan 
 rahul.ranjan...@gmail.com wrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry 
 dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in
 the
 post fix format .

 Example: If the integer expression is in the prefix format is
 *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

  --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




-- 

   Regards
 Himanshu Kansal
   Msc Comp. sc.
(University of Delhi)

-- 
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 

Re: [algogeeks] Question asked in Amazon Online Test

2012-06-30 Thread utsav sharma
@bhaskar  himanshu :- can u please explain ur algo for a * ( b + ( ( c - d
) / e ) )

On Sat, Jun 30, 2012 at 11:50 AM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 i think this algo will do...
 reverse the given prefix expression
 while(!nd of input)
 { if it is operand
 push in a stack
   if its an operator
   {  op1=pop(stack);
  op2=pop(stack);
  push (op1 op2 operator) on to stack;

   }
 }
 On Sat, Jun 30, 2012 at 1:56 AM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 example
 -+53+2/36
 step 1: 63/2+35+-
 step 2: 36/2+53+-

 On Sat, Jun 30, 2012 at 1:55 AM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 reverse the prefix notation and then reverse each continuous occurence
 of operands


 On Sat, Jun 30, 2012 at 12:50 AM, Abhishek Sharma 
 abhi120...@gmail.comwrote:

 convert prefix to infix,then convert infix to postfix.Now, to convert
 prefix to infix, push numbers in one stack and operators in other.Then use
 thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
  algo
 to perform this.Then do the same for infix to postfix.It works with simple
 operators,but difficult to implement with parenthesis.


 On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan 
 rahul.ranjan...@gmail.com wrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.com
  wrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in
 the
 post fix format .

 Example: If the integer expression is in the prefix format is
 *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

  --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --

Regards
  Himanshu Kansal
Msc Comp. sc.
 (University of Delhi)


  --
 You received this message because you are subscribed to the Google 

Re: [algogeeks] Question asked in Amazon Online Test

2012-06-30 Thread achala sharma
I think no need to reverse the string,following program is giving me
correct o/p.Although right now this program will work only for binary
operator,for unary add extra condition

main()
{
 char str[100];
 int i=0;
 int digit;
 scanf(%s,str);
 while(str[i])
 {
  if(isdigit(str[i]))
  {
   printf(%c,str[i]);
   if(isdigit(str[i+1]))
   {
printf(%c,str[i+1]);
digit=popstack();
printf(%c,digit);
i++;
   }

  }
  else if(str[i]=33  str[i]=47)
  {
   pushstack(str[i]);
  }
  i++;
 }
 while(top!=0)
 {
  digit=popstack();
  printf(%c,digit);
 }
}

On Sat, Jun 30, 2012 at 11:50 AM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 i think this algo will do...
 reverse the given prefix expression
 while(!nd of input)
 { if it is operand
 push in a stack
   if its an operator
   {  op1=pop(stack);
  op2=pop(stack);
  push (op1 op2 operator) on to stack;

   }
 }
 On Sat, Jun 30, 2012 at 1:56 AM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 example
 -+53+2/36
 step 1: 63/2+35+-
 step 2: 36/2+53+-

 On Sat, Jun 30, 2012 at 1:55 AM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 reverse the prefix notation and then reverse each continuous occurence
 of operands


 On Sat, Jun 30, 2012 at 12:50 AM, Abhishek Sharma 
 abhi120...@gmail.comwrote:

 convert prefix to infix,then convert infix to postfix.Now, to convert
 prefix to infix, push numbers in one stack and operators in other.Then use
 thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
  algo
 to perform this.Then do the same for infix to postfix.It works with simple
 operators,but difficult to implement with parenthesis.


 On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan 
 rahul.ranjan...@gmail.com wrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.com
  wrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in
 the
 post fix format .

 Example: If the integer expression is in the prefix format is
 *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

 --
 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.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 You received this message 

[algogeeks] Question asked in Amazon Online Test

2012-06-29 Thread Gobind Kumar Hembram
Given an integer expression in a prefix format (i.e. the operator
precedes the number it is operating on) ,  print the expression in the
post fix format .

Example: If the integer expression is in the prefix format is *+56-78,
the postfix format expression is 56+78-*. Both of these
correspond to the expression (5+6)*(7-8).

-- 
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 Amazon Online Test

2012-06-29 Thread Bhaskar Kushwaha
I think just reversing the prefix notation converts it to postfix notation


On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram
gobind@gmail.comwrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




-- 
regards,
Bhaskar Kushwaha
Student
Final year
CSE
M.N.N.I.T.  Allahabad

-- 
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 Amazon Online Test

2012-06-29 Thread amrit harry
@bhaskar ur algo fails on this case (5+3)-(2+(3/6))
-+53+2/36
63/2+35-+
showing that 6/3 but actually it is 3/6
so i think it could be done by folowing algo
make a binary tree of given expression in O(n)  then do postorder traversal
take O(n) so problem can be solved in O(n). and take O(2*n+1) space

On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




-- 
Thanks  Regards
Amritpal singh

-- 
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 Amazon Online Test

2012-06-29 Thread rahul ranjan
oh bhai mere. kewal preorder use karke kaise tree bana dega???

On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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 Amazon Online Test

2012-06-29 Thread Abhishek Sharma
convert prefix to infix,then convert infix to postfix.Now, to convert
prefix to infix, push numbers in one stack and operators in other.Then use
thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
algo
to perform this.Then do the same for infix to postfix.It works with simple
operators,but difficult to implement with parenthesis.

On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan rahul.ranjan...@gmail.comwrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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.




-- 
Abhishek Sharma
Under-Graduate Student,
PEC University of Technology

-- 
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 Amazon Online Test

2012-06-29 Thread Bhaskar Kushwaha
reverse the prefix notation and then reverse each continuous occurence of
operands

On Sat, Jun 30, 2012 at 12:50 AM, Abhishek Sharma abhi120...@gmail.comwrote:

 convert prefix to infix,then convert infix to postfix.Now, to convert
 prefix to infix, push numbers in one stack and operators in other.Then use
 thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
  algo
 to perform this.Then do the same for infix to postfix.It works with simple
 operators,but difficult to implement with parenthesis.


 On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan 
 rahul.ranjan...@gmail.comwrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

  --
 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.




-- 
regards,
Bhaskar Kushwaha
Student
Final year
CSE
M.N.N.I.T.  Allahabad

-- 
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 Amazon Online Test

2012-06-29 Thread Bhaskar Kushwaha
example
-+53+2/36
step 1: 63/2+35+-
step 2: 36/2+53+-

On Sat, Jun 30, 2012 at 1:55 AM, Bhaskar Kushwaha 
bhaskar.kushwaha2...@gmail.com wrote:

 reverse the prefix notation and then reverse each continuous occurence of
 operands


 On Sat, Jun 30, 2012 at 12:50 AM, Abhishek Sharma abhi120...@gmail.comwrote:

 convert prefix to infix,then convert infix to postfix.Now, to convert
 prefix to infix, push numbers in one stack and operators in other.Then use
 thishttp://www.velocityreviews.com/forums/t445633-prefix-to-infix-conversion.html
  algo
 to perform this.Then do the same for infix to postfix.It works with simple
 operators,but difficult to implement with parenthesis.


 On Sat, Jun 30, 2012 at 12:21 AM, rahul ranjan rahul.ranjan...@gmail.com
  wrote:

 oh bhai mere. kewal preorder use karke kaise tree bana dega???


 On Fri, Jun 29, 2012 at 11:23 PM, amrit harry 
 dabbcomput...@gmail.comwrote:

 @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
 -+53+2/36
 63/2+35-+
 showing that 6/3 but actually it is 3/6
 so i think it could be done by folowing algo
 make a binary tree of given expression in O(n)  then do postorder
 traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
 space

 On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha 
 bhaskar.kushwaha2...@gmail.com wrote:

 I think just reversing the prefix notation converts it to postfix
 notation


 On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given an integer expression in a prefix format (i.e. the operator
 precedes the number it is operating on) ,  print the expression in the
 post fix format .

 Example: If the integer expression is in the prefix format is *+56-78,
 the postfix format expression is 56+78-*. Both of these
 correspond to the expression (5+6)*(7-8).

 --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad

  --
 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.




 --
 Thanks  Regards
 Amritpal singh

  --
 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.




 --
 Abhishek Sharma
 Under-Graduate Student,
 PEC University of Technology

  --
 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.




 --
 regards,
 Bhaskar Kushwaha
 Student
 Final year
 CSE
 M.N.N.I.T.  Allahabad




-- 
regards,
Bhaskar Kushwaha
Student
Final year
CSE
M.N.N.I.T.  Allahabad

-- 
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-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.



[algogeeks] Question asked in Amazon online test

2012-06-23 Thread Gobind Kumar Hembram
Given an array containing sequence of bits (0 or 1), you have to sort
this array in the ascending order i.e. all 0' in first part of array
followed by all 1's.   The constraints is that you can swap only the
adjacent elements in the array. Find the minimum number of swaps
required to sort the given input array.

Example:   Given the array (0,0,1,0,1,0,1,1) the minimum number of swaps is 3.

-- 
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 Amazon Online test

2012-06-23 Thread Guruprasad Sridharan
Let u and r be the distance to move in the up and right directions. u=y2-y1
and r=x2-x1.

We have to move a total of u+r units. So the answer would be (u+r)!/u!r!
since we are counting only the distinct paths.
Each path from (x1,y1) to (x2,y2)  may be expressed as a sequence of u+r
steps consisting of U or R.
If seq[i] has U then it means we moved up at the i th step. Similarly R is
for right. The number of distinct paths would be the number of distinct
arrangements of the sequence.

On Sat, Jun 23, 2012 at 11:05 AM, Gobind Kumar Hembram gobind@gmail.com
 wrote:

 Given two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where
 x2=x1 and y2=y1. Find the total number of distinct paths between
 (x1, y1) and (x2, y2). You can only move in right direction i.e.
 positive x direction (+1, 0) or in up direction i.e. positive y
 direction (0, +1) from any given position.

 Example: If the given coordinates are  (3,3)  and (5,5), the number of
 distinct paths are 6 :  one going through 3,5 ; one going through 5,3
 and four going through 4,4.

 --
 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 Amazon online test

2012-06-23 Thread Guruprasad Sridharan
Use a merge sort like procedure to count the number of inversions such that
0 appears after 1.

On Sat, Jun 23, 2012 at 11:34 AM, Gobind Kumar Hembram gobind@gmail.com
 wrote:

 Given an array containing sequence of bits (0 or 1), you have to sort
 this array in the ascending order i.e. all 0' in first part of array
 followed by all 1's.   The constraints is that you can swap only the
 adjacent elements in the array. Find the minimum number of swaps
 required to sort the given input array.

 Example:   Given the array (0,0,1,0,1,0,1,1) the minimum number of swaps
 is 3.

 --
 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 Amazon online test

2012-06-23 Thread Gobind Kumar Hembram
If we use merge sort like procedure,ans will be 1 here it should be
3.we have to swap 0s and 1s linearly.

-- 
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 Amazon online test

2012-06-23 Thread Guruprasad Sridharan
We need to sort as we count the inversions.

On Sat, Jun 23, 2012 at 11:56 AM, Gobind Kumar Hembram gobind@gmail.com
 wrote:

 If we use merge sort like procedure,ans will be 1 here it should be
 3.we have to swap 0s and 1s linearly.

 --
 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 Amazon Online test

2012-06-23 Thread Kumar Vishal
bcaz choosing any vertical will automatically fix the horizontals and
vice verse
(u+r) C r= (u+r) C u

On Sat, Jun 23, 2012 at 1:08 PM, Kumar Vishal kumar...@gmail.com wrote:

Let u and r be the distance to move in the up and right directions.
 u=y2-y1 and r=x2-x1.
(u+r) C r


 On Sat, Jun 23, 2012 at 11:40 AM, Guruprasad Sridharan 
 sridharan.mi...@gmail.com wrote:

 Let u and r be the distance to move in the up and right directions.
 u=y2-y1 and r=x2-x1.

 We have to move a total of u+r units. So the answer would be (u+r)!/u!r!
 since we are counting only the distinct paths.
 Each path from (x1,y1) to (x2,y2)  may be expressed as a sequence of u+r
 steps consisting of U or R.
 If seq[i] has U then it means we moved up at the i th step. Similarly R
 is for right. The number of distinct paths would be the number of distinct
 arrangements of the sequence.

 On Sat, Jun 23, 2012 at 11:05 AM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where
 x2=x1 and y2=y1. Find the total number of distinct paths between
 (x1, y1) and (x2, y2). You can only move in right direction i.e.
 positive x direction (+1, 0) or in up direction i.e. positive y
 direction (0, +1) from any given position.

 Example: If the given coordinates are  (3,3)  and (5,5), the number of
 distinct paths are 6 :  one going through 3,5 ; one going through 5,3
 and four going through 4,4.

 --
 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.




 --
 Regards
 Kumar Vishal
 _
 *http://wethecommonpeople.wordpress.com/   *
 *h**ttp://kumartechnicalarticles.wordpress.com/http://kumartechnicalarticles.wordpress.com/
 *
 _





-- 
Regards
Kumar Vishal
_
*http://wethecommonpeople.wordpress.com/   *
*h**ttp://kumartechnicalarticles.wordpress.com/http://kumartechnicalarticles.wordpress.com/
*
_

-- 
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 Amazon Online test

2012-06-23 Thread Kumar Vishal
   Let u and r be the distance to move in the up and right directions.
u=y2-y1 and r=x2-x1.
   (u+r)Cr

On Sat, Jun 23, 2012 at 11:40 AM, Guruprasad Sridharan 
sridharan.mi...@gmail.com wrote:

 Let u and r be the distance to move in the up and right directions.
 u=y2-y1 and r=x2-x1.

 We have to move a total of u+r units. So the answer would be (u+r)!/u!r!
 since we are counting only the distinct paths.
 Each path from (x1,y1) to (x2,y2)  may be expressed as a sequence of u+r
 steps consisting of U or R.
 If seq[i] has U then it means we moved up at the i th step. Similarly R is
 for right. The number of distinct paths would be the number of distinct
 arrangements of the sequence.

 On Sat, Jun 23, 2012 at 11:05 AM, Gobind Kumar Hembram 
 gobind@gmail.com wrote:

 Given two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where
 x2=x1 and y2=y1. Find the total number of distinct paths between
 (x1, y1) and (x2, y2). You can only move in right direction i.e.
 positive x direction (+1, 0) or in up direction i.e. positive y
 direction (0, +1) from any given position.

 Example: If the given coordinates are  (3,3)  and (5,5), the number of
 distinct paths are 6 :  one going through 3,5 ; one going through 5,3
 and four going through 4,4.

 --
 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.




-- 
Regards
Kumar Vishal
_
*http://wethecommonpeople.wordpress.com/   *
*h**ttp://kumartechnicalarticles.wordpress.com/http://kumartechnicalarticles.wordpress.com/
*
_

-- 
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

2012-06-23 Thread Gobind Kumar Hembram
Write a function longest_palindrome,  which takes an array of strings
as argument and returns the
longest palindrome in that array if any.Please give ideas how to
implement this function.

-- 
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 Amazon Online test

2012-06-22 Thread Gobind Kumar Hembram
Given two positions in a 2-D matrix, say (x1, y1) and (x2, y2) where
x2=x1 and y2=y1. Find the total number of distinct paths between
(x1, y1) and (x2, y2). You can only move in right direction i.e.
positive x direction (+1, 0) or in up direction i.e. positive y
direction (0, +1) from any given position.

Example: If the given coordinates are  (3,3)  and (5,5), the number of
distinct paths are 6 :  one going through 3,5 ; one going through 5,3
and four going through 4,4.

-- 
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

2012-06-22 Thread Gobind Kumar Hembram
Given an integer expression in a prefix format (i.e. the operator
precedes the number it is operating on) ,  print the expression in the
post fix format .

Example: If the integer expression is in the prefix format is *+56-78,
the postfix format expression is 56+78-*. Both of these
correspond to the expression (5+6)*(7-8).

-- 
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

2011-09-21 Thread prasanth n
You have given a positive number you have to find a number which is bigger
than that by using same digits available in the number .
Example :-
You have given a number 7585 , your output should be 7855 .

-- 
*prasanth*

-- 
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

2011-09-21 Thread kartik sachan
http://ideone.com/xRnDo

# includestdio.h# includestring.hvoid findbig(char *a){
int i,j;
int flag=0;
for(i=strlen(a)-1;i0;i--)
if(a[i-1]a[i])
{
char temp=a[i];
a[i]=a[i-1];
a[i-1]=temp;
flag=1;
break;

}
if(flag==1)
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(%s,a);
else
printf 
http://www.opengroup.org/onlinepubs/009695399/functions/printf.html(NO
number OF SAME DIGITS EXIT\n);
}int main(){
char a[]=7585;
findbig(a);return 0;}

correct me if i am worng

-- 
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 --

2011-09-20 Thread Ishan Aggarwal
You are given two 32-bit numbers, N and M, and two bit positions, i and
j.Write a method to set all bits between i and j in N equal to M (e.g., M
becomes a substring of N located at i and starting at j).

EXAMPLE:

Input: N = 100, M = 10101, i = 2, j = 6

Output: N = 10001010100

-- 
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.com puneet.ar...@aricent.com

-- 
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 --

2011-09-20 Thread abhinav gupta
I can tell you the logic.Take two arrays N and M, put their bits in
the array.
Now using i and j index replace the value of N[j] to n[i] by M[j] to M[i].
On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




-- 
@ |3  # ! /\/ @ \./

-- 
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 --

2011-09-20 Thread abhinav gupta
U can use single walker (from 0 till 31) to convert integers N and M into
array of bits, then
another walker from i to j to replace values.

for(k=31;k=0;k++)
{
N[k]=n  01;
M[k]=m 01;
n=1;
m=1;
}

for(k=i;k=j;k++)
N[k]=M[k];

On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta
guptaabhinav...@gmail.comwrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




-- 
@ |3  # ! /\/ @ \./

-- 
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 --

2011-09-20 Thread Ishan Aggarwal
What are u doing in the first loop running for k=31 to k =0?

On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta
guptaabhinav...@gmail.comwrote:

 U can use single walker (from 0 till 31) to convert integers N and M into
 array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

 On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta guptaabhinav...@gmail.com
  wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




-- 
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.com puneet.ar...@aricent.com

-- 
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 --

2011-09-20 Thread Yogesh Yadav
+1 abhinav

but u forgot to change array again into bits...

...
On Tue, Sep 20, 2011 at 1:02 PM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 What are u doing in the first loop running for k=31 to k =0?


 On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta guptaabhinav...@gmail.com
  wrote:

 U can use single walker (from 0 till 31) to convert integers N and M into
 array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

 On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

  --
 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 --

2011-09-20 Thread abhinav gupta
Its because o/p should look like dat.Bt dats simple you can do it
by multiplying bits to power(2, i) and
adding all expressions.Simple!
On Tue, Sep 20, 2011 at 1:09 PM, abhinav gupta guptaabhinav...@gmail.comwrote

 In the first loop bits are added into the array N and M .I have taken two
 integers n and m .
 Caution :
 declare


 int N[31]={0};
 int M[31]={0};
 int n,m,i,j;

   On Tue, Sep 20, 2011 at 1:02 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 What are u doing in the first loop running for k=31 to k =0?


 On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 U can use single walker (from 0 till 31) to convert integers N and M into
 array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

   On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




-- 
@ |3  # ! /\/ @ \./

-- 
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 --

2011-09-20 Thread abhinav gupta
In the first loop bits are added into the array N and M .I have taken two
integers n and m .
Caution :
declare


int N[31]={0};
int M[31]={0};
int n,m,i,j;

On Tue, Sep 20, 2011 at 1:02 PM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 What are u doing in the first loop running for k=31 to k =0?


 On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta guptaabhinav...@gmail.com
  wrote:

 U can use single walker (from 0 till 31) to convert integers N and M into
 array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

   On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i and
 j.Write a method to set all bits between i and j in N equal to M (e.g., M
 becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




-- 
@ |3  # ! /\/ @ \./

-- 
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 --

2011-09-20 Thread abhinav gupta
You can also solve the problem by using bit operators. by using| !
.
Need sm thinking in dat..No time rite nw!

On Tue, Sep 20, 2011 at 1:12 PM, abhinav gupta guptaabhinav...@gmail.comwrote:

 Its because o/p should look like dat.Bt dats simple you can do it
 by multiplying bits to power(2, i) and
 adding all expressions.Simple!
 On Tue, Sep 20, 2011 at 1:09 PM, abhinav gupta 
 guptaabhinav...@gmail.comwrote

  In the first loop bits are added into the array N and M .I have taken two
 integers n and m .
 Caution :
 declare


 int N[31]={0};
 int M[31]={0};
 int n,m,i,j;

   On Tue, Sep 20, 2011 at 1:02 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 What are u doing in the first loop running for k=31 to k =0?


 On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 U can use single walker (from 0 till 31) to convert integers N and M
 into array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

   On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i
 and j.Write a method to set all bits between i and j in N equal to M 
 (e.g.,
 M becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./




-- 
@ |3  # ! /\/ @ \./

-- 
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 --

2011-09-20 Thread surender sanke
t = j-i+1; // total number bits (t) between i and j , i=2,j=6
t = 2^t-1; // value would be  2^5-1  .. 0001 
t = ~t ;//  ...1110 
t = ti | 2^i-1 // 1000 0011
N = N  t; // resets all bits between i and j to 0 in N
N = N | Mi; sets bits in N with bits in M

surender

On Tue, Sep 20, 2011 at 1:13 PM, abhinav gupta guptaabhinav...@gmail.comwrote:

 You can also solve the problem by using bit operators. by using| !
 .
 Need sm thinking in dat..No time rite nw!

 On Tue, Sep 20, 2011 at 1:12 PM, abhinav gupta 
 guptaabhinav...@gmail.comwrote:

 Its because o/p should look like dat.Bt dats simple you can do it
 by multiplying bits to power(2, i) and
 adding all expressions.Simple!
 On Tue, Sep 20, 2011 at 1:09 PM, abhinav gupta guptaabhinav...@gmail.com
  wrote

  In the first loop bits are added into the array N and M .I have taken
 two integers n and m .
 Caution :
 declare


 int N[31]={0};
 int M[31]={0};
 int n,m,i,j;

   On Tue, Sep 20, 2011 at 1:02 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 What are u doing in the first loop running for k=31 to k =0?


 On Tue, Sep 20, 2011 at 12:50 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 U can use single walker (from 0 till 31) to convert integers N and M
 into array of bits, then
 another walker from i to j to replace values.

 for(k=31;k=0;k++)
 {
 N[k]=n  01;
 M[k]=m 01;
 n=1;
 m=1;
 }

 for(k=i;k=j;k++)
 N[k]=M[k];

   On Tue, Sep 20, 2011 at 12:44 PM, abhinav gupta 
 guptaabhinav...@gmail.com wrote:

 I can tell you the logic.Take two arrays N and M, put their bits in
 the array.
 Now using i and j index replace the value of N[j] to n[i] by M[j] to
 M[i].
   On Tue, Sep 20, 2011 at 12:33 PM, Ishan Aggarwal 
 ishan.aggarwal.1...@gmail.com wrote:

 You are given two 32-bit numbers, N and M, and two bit positions, i
 and j.Write a method to set all bits between i and j in N equal to M 
 (e.g.,
 M becomes a substring of N located at i and starting at j).

 EXAMPLE:

 Input: N = 100, M = 10101, i = 2, j = 6

 Output: N = 10001010100

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
 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.




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./




 --
 @ |3  # ! /\/ @ \./

 --
 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 on algorithm

2011-09-16 Thread prasanth n
Given an infinite number of quarters (25 cents), dimes (10 cents), nickels
(5 cents) and pennies (1 cent), write code to calculate the number of ways
of representing n cents.
also do give an algorithm first..

-- 
*prasanth*

-- 
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.



Fwd: [algogeeks] Question -- plz answer

2011-09-12 Thread t.yogendra nath babu babu
If u have any questions like please post in this forum

www.buddysforum.com



-- Forwarded message --
From: Ishan Aggarwal ishan.aggarwal.1...@gmail.com
Date: Sat, Sep 10, 2011 at 8:10 PM
Subject: [algogeeks] Question -- plz answer
To: algogeeks@googlegroups.com


1.)

there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
on..
It looks something like this
1
2 3
4 5 6
every cup has capacity C. you pour L liters of water from top . when cup 1
gets filled , it overflows to cup 2,3 equally, and when they get filled ,
Cup 4 and 6 get water only from 2 and 3 resp but 5 gets water from both the
cups and so on.
Now given C and M .Find the amount of water in ith cup.



-- 
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.com puneet.ar...@aricent.com

 --
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 -- plz answer

2011-09-10 Thread Ishan Aggarwal
1.)

there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
on..
It looks something like this
1
2 3
4 5 6
every cup has capacity C. you pour L liters of water from top . when cup 1
gets filled , it overflows to cup 2,3 equally, and when they get filled ,
Cup 4 and 6 get water only from 2 and 3 resp but 5 gets water from both the
cups and so on.
Now given C and M .Find the amount of water in ith cup.



-- 
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.com puneet.ar...@aricent.com

-- 
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 -- plz answer

2011-09-10 Thread bharatkumar bagana
what is M?

On Sat, Sep 10, 2011 at 8:10 PM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 1.)

 there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
 on..
 It looks something like this
 1
 2 3
 4 5 6
 every cup has capacity C. you pour L liters of water from top . when cup 1
 gets filled , it overflows to cup 2,3 equally, and when they get filled ,
 Cup 4 and 6 get water only from 2 and 3 resp but 5 gets water from both the
 cups and so on.
 Now given C and M .Find the amount of water in ith cup.



 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

  --
 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.




-- 

**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers = Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
*
Mobile +91 8056127652*
bagana.bharatku...@gmail.com

-- 
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 in C

2011-08-24 Thread sadhana kumar
Can anyone explain this code pls??

#include stdio.h
#define f(a,b) a##b
#define g(a) #a
#define h(a) g(a)
int main()
{
printf(%s\n,h(f(1,2)));
printf(%s\n,g(f(1,2)));
return 0;
}

-- 
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 on fork()

2011-08-22 Thread dexter does
void red()
{

}
void green()
{

}
main()
{
  fork();
  int color=fork();
  if(color==0)
  fork();
  red();
  if(color==0)
  fork();
  green();
  getch();

}


How many times red and green are called and pls give an explanation for your
answer

-- 
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 to code

2011-08-22 Thread tanuj chawla
@sanjay - shouldnt we use count instead of second k. and when count
becomes size/2,we get the element becouse we dont know the array in which
that element resides
correct me if m wrong??

-- 
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 to code

2011-08-22 Thread Sanjay Rajpal
in the solution I proposed, k is doing the job of count. I think u should
look at it again.


Sanju
:)



On Mon, Aug 22, 2011 at 1:42 AM, tanuj chawla houndhun...@gmail.com wrote:

 @sanjay - shouldnt we use count instead of second k. and when count
 becomes size/2,we get the element becouse we dont know the array in which
 that element resides
 correct me if m wrong??



 --
 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 on fork()

2011-08-22 Thread ghsjgl k
i saw this question in one of DREAM companies

i dont know the answer

On Mon, Aug 22, 2011 at 11:43 AM, dexter does dxterd...@gmail.com wrote:

 void red()
 {

 }
 void green()
 {

 }
 main()
 {
   fork();
   int color=fork();
   if(color==0)
   fork();
   red();
   if(color==0)
   fork();
   green();
   getch();

 }


 How many times red and green are called and pls give an explanation for
 your answer

 --
 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 to code

2011-08-21 Thread vaibhav shukla
given three sorted arrays not necessary of same length (length is given)
we have to determine the middle element such that  the element will be the
middle one of the such an array which will be formed if all three given
arrays are merged in
sorted order.
input  :- arr1 :  1,3,5,7
arr2 :   6,9,12,15,18
arr3 :  2,4,14,20
output : 7 , as if we merge the arrays in sorted order then 7 will be the
middle element of that merged array.
note : if merged array is of even length then there will be two middle
element.

ALSO YOU CANNOT USE EXTRA MEMORY.


-- 
  best wishes!!
Vaibhav

-- 
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 to code

2011-08-21 Thread Puneet Chawla
Here by just applying merge on these array as they are sorted and calculate
the middle element..Am i rt..???

On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 given three sorted arrays not necessary of same length (length is given)
 we have to determine the middle element such that  the element will be the
 middle one of the such an array which will be formed if all three given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be the
 middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


  --
 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.




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

-- 
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 to code

2011-08-21 Thread Sanjay Rajpal
Take three pointers to the beginning of each array say i,j,k.

Now let sum = len a +len b + len c.
k=0

now start from the beginning, compare elements at indexes i,j,k.
which ever is smaller, increment that index and k, continue till k becomes
sum/2.

when k becomes sum/2, this element will be middle element of the merged
array.

I think it could also be done in O(log m + log n + log p), where m, n,p are
lengths of the arrays.

Correct me if m wrong :)
Sanju
:)



On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla
puneetchawla...@gmail.comwrote:

 Here by just applying merge on these array as they are sorted and calculate
 the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 given three sorted arrays not necessary of same length (length is given)
 we have to determine the middle element such that  the element will be the
 middle one of the such an array which will be formed if all three given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be the
 middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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 to code

2011-08-21 Thread vaibhav shukla
@puneet : but u cant use extra memory

On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k becomes
 sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p are
 lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla puneetchawla...@gmail.com
  wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla vaibhav200...@gmail.com
  wrote:

 given three sorted arrays not necessary of same length (length is given)
 we have to determine the middle element such that  the element will be
 the middle one of the such an array which will be formed if all three given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be the
 middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




-- 
  best wishes!!
Vaibhav
  MCA

-- 
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 to code

2011-08-21 Thread Puneet Chawla
ohh sryy i didn't read tht

On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 @puneet : but u cant use extra memory


 On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k becomes
 sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p
 are lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 given three sorted arrays not necessary of same length (length is given)
 we have to determine the middle element such that  the element will be
 the middle one of the such an array which will be formed if all three given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be
 the middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




 --
   best wishes!!
 Vaibhav
   MCA


  --
 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.




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

-- 
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 to code

2011-08-21 Thread vaibhav shukla
@sanjay : yes this is one approach . just doing this and keeping track of
the smaller element and wen k is sum/2, the minimum element of the middle on

true. but any other approach apart from this and wat if the total length is
even, i.e u have to give two middle elements then

On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 @puneet : but u cant use extra memory


 On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k becomes
 sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p
 are lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 given three sorted arrays not necessary of same length (length is given)
 we have to determine the middle element such that  the element will be
 the middle one of the such an array which will be formed if all three given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be
 the middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




 --
   best wishes!!
 Vaibhav
   MCA




-- 
  best wishes!!
Vaibhav
  MCA

-- 
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 to code

2011-08-21 Thread Puneet Chawla
@sanjay why you have compared k with sum/2 is it a general solution..???

On Sun, Aug 21, 2011 at 11:11 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 @sanjay : yes this is one approach . just doing this and keeping track of
 the smaller element and wen k is sum/2, the minimum element of the middle on

 true. but any other approach apart from this and wat if the total length is
 even, i.e u have to give two middle elements then


 On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 @puneet : but u cant use extra memory


 On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.com wrote:

 Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k
 becomes sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p
 are lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 given three sorted arrays not necessary of same length (length is
 given)
 we have to determine the middle element such that  the element will be
 the middle one of the such an array which will be formed if all three 
 given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be
 the middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




 --
   best wishes!!
 Vaibhav
   MCA




 --
   best wishes!!
 Vaibhav
   MCA

  --
 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.




-- 
With regards
  
Puneet Chawla
Computer Engineering Student
NIT Kurukshetra

-- 
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 to code

2011-08-21 Thread Sanjay Rajpal
see sum is total no.of elements in three arrays.

the question is middle element in the merged array.

so the middle element would be at index sum/2.
Sanju
:)



On Sun, Aug 21, 2011 at 10:46 AM, Puneet Chawla
puneetchawla...@gmail.comwrote:

 @sanjay why you have compared k with sum/2 is it a general solution..???


 On Sun, Aug 21, 2011 at 11:11 PM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 @sanjay : yes this is one approach . just doing this and keeping track of
 the smaller element and wen k is sum/2, the minimum element of the middle on


 true. but any other approach apart from this and wat if the total length
 is even, i.e u have to give two middle elements then


 On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla vaibhav200...@gmail.com
  wrote:

 @puneet : but u cant use extra memory


 On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k
 becomes sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p
 are lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 given three sorted arrays not necessary of same length (length is
 given)
 we have to determine the middle element such that  the element will be
 the middle one of the such an array which will be formed if all three 
 given
 arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be
 the middle element of that merged array.
 note : if merged array is of even length then there will be two middle
 element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




 --
   best wishes!!
 Vaibhav
   MCA




 --
   best wishes!!
 Vaibhav
   MCA

   --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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 to code

2011-08-21 Thread Sanjay Rajpal
http://stackoverflow.com/questions/6182488/median-of-5-sorted-arrays this
link will help m damn sure.
Sanju
:)



On Sun, Aug 21, 2011 at 10:48 AM, Sanjay Rajpal srn...@gmail.com wrote:

  see sum is total no.of elements in three arrays.

 the question is middle element in the merged array.

 so the middle element would be at index sum/2.
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:46 AM, Puneet Chawla puneetchawla...@gmail.com
  wrote:

 @sanjay why you have compared k with sum/2 is it a general solution..???


 On Sun, Aug 21, 2011 at 11:11 PM, vaibhav shukla vaibhav200...@gmail.com
  wrote:

 @sanjay : yes this is one approach . just doing this and keeping track of
 the smaller element and wen k is sum/2, the minimum element of the middle on


 true. but any other approach apart from this and wat if the total length
 is even, i.e u have to give two middle elements then


 On Sun, Aug 21, 2011 at 11:09 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 @puneet : but u cant use extra memory


 On Sun, Aug 21, 2011 at 11:08 PM, Sanjay Rajpal srn...@gmail.comwrote:

  Take three pointers to the beginning of each array say i,j,k.

 Now let sum = len a +len b + len c.
 k=0

 now start from the beginning, compare elements at indexes i,j,k.
 which ever is smaller, increment that index and k, continue till k
 becomes sum/2.

 when k becomes sum/2, this element will be middle element of the merged
 array.

 I think it could also be done in O(log m + log n + log p), where m, n,p
 are lengths of the arrays.

 Correct me if m wrong :)
 Sanju
 :)



 On Sun, Aug 21, 2011 at 10:34 AM, Puneet Chawla 
 puneetchawla...@gmail.com wrote:

 Here by just applying merge on these array as they are sorted and
 calculate the middle element..Am i rt..???


 On Sun, Aug 21, 2011 at 10:59 PM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 given three sorted arrays not necessary of same length (length is
 given)
 we have to determine the middle element such that  the element will
 be the middle one of the such an array which will be formed if all three
 given arrays are merged in
 sorted order.
 input  :- arr1 :  1,3,5,7
 arr2 :   6,9,12,15,18
 arr3 :  2,4,14,20
 output : 7 , as if we merge the arrays in sorted order then 7 will be
 the middle element of that merged array.
 note : if merged array is of even length then there will be two
 middle element.

 ALSO YOU CANNOT USE EXTRA MEMORY.


 --
   best wishes!!
 Vaibhav


 --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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.




 --
   best wishes!!
 Vaibhav
   MCA




 --
   best wishes!!
 Vaibhav
   MCA

   --
 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.




 --
 With regards
   
 Puneet Chawla
 Computer Engineering Student
 NIT Kurukshetra

 --
 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 from Google interview

2011-08-19 Thread arun kumar
Build a Trie... Recursive search on trie This ll give you all
possible interpretation of the given key

On 8/18/11, Navneet Gupta navneetn...@gmail.com wrote:
 Given a string containing multiple words such that spaces between words is
 missing. Also, you have a dictionary containing valid words.

 Ex. Thatwouldbefantastic

 Output a string with proper spaces inserted.

 Output - That would be fantastic

 The case of words like bandwidth present can be discounted.

 --
 Regards,
 Navneet

 --
 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.



-- 
Sent from my mobile device

-- 
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 from Google interview

2011-08-19 Thread priya ramesh
Hash in the dictionary for the first letter in the string. Check if any word
in the dictionary beginning with this letter is a substring of the given
string. If yes and if the substring forms the initial part of the string,
tokenize it. Continue the process with the next word.

-- 
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 from Google interview

2011-08-18 Thread Navneet Gupta
Given a string containing multiple words such that spaces between words is
missing. Also, you have a dictionary containing valid words.

Ex. Thatwouldbefantastic

Output a string with proper spaces inserted.

Output - That would be fantastic

The case of words like bandwidth present can be discounted.

-- 
Regards,
Navneet

-- 
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 from Google interview

2011-08-18 Thread aditya kumar
not sure abt the algo but we can think in terms of tokeninzing . ie go for
greedy method . greedy looks for maximum match . extract the token and match
with the dictionary word . if match found then add the additional space else
look for next token .
On Thu, Aug 18, 2011 at 9:10 PM, Navneet Gupta navneetn...@gmail.comwrote:

 Given a string containing multiple words such that spaces between words is
 missing. Also, you have a dictionary containing valid words.

 Ex. Thatwouldbefantastic

 Output a string with proper spaces inserted.

 Output - That would be fantastic

 The case of words like bandwidth present can be discounted.

 --
 Regards,
 Navneet


 --
 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

2011-08-06 Thread UTKARSH SRIVASTAV
CAN ANYONe PLEASE TELL ME WHICH TEST CASE I AM GETTING WRONG
I HAVE TRIED ALL WHICH I COULD TRY IN THIS PROBLEM
http://www.spoj.pl/problems/M00PAIR/

 MY SOLUTION

-- 
#includestdio.h
#includestring.h

int fun(char *s)
{
  int i,n;
for(i=0;s[i]!='\0';i++);
i=i-1;
n=0;
while(i=0)
{
   n=10*n+(s[i]-'0');
   i--;
}
return n;
}
void add(char *p,char *q,char *r)
{
 int c=0,i,temp;

 for(i=0;p[i]!='\0'q[i]!='\0';i++)
 {
   temp=p[i]-'0'+q[i] -'0' +c;
   r[i]=temp%10+'0';
   c=temp/10;
 }
  while(p[i]!='\0')
 {
  temp=p[i]-'0'+c;
  r[i]=temp%10+'0';
  c=temp/10;
  i++;
 }
  while(q[i]!='\0')
 {
  temp=q[i]-'0'+c;
  r[i]=temp%10+'0';
  c=temp/10;
  i++;
 }
 while(c!=0)
 {
r[i]=c+'0';
c=c/10;
i++;
 }
 r[i]='\0';

}

main()
{  char
one[2000]=1,zone[2000]=0,dzero[2000]=0,ans[1005][2000],k[2000],l[2000],m[2000];

  int i,n,f,uo,oop;
  char s[6];;

  ans[0][0]='0';

  for(i=1;i=999;i++)
  {
   strcpy(k,one);

   strcpy(l,zone);

   strcpy(m,dzero);

   add(k,m,zone);


   add(zone,l,one);

   strcpy(dzero,l);

   oop=0;

  uo=strlen(dzero);

  for(f=uo-1;f=0;f--)
  ans[i][oop++]=dzero[f];
   ans[i][oop]='\0';

  }
  while( (scanf(%s,s))!=EOF )
  {

  n=fun(s);

  printf(%s\n,ans[n]);

  }

  return 0;
}

*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
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

2011-08-06 Thread saurabh singh
You are taking string as a variable when a simple int would do...:)
check your fun() function otherwise i got AC with same idea as u have used

On Sat, Aug 6, 2011 at 4:40 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:

 CAN ANYONe PLEASE TELL ME WHICH TEST CASE I AM GETTING WRONG
 I HAVE TRIED ALL WHICH I COULD TRY IN THIS PROBLEM
 http://www.spoj.pl/problems/M00PAIR/

  MY SOLUTION

 --
 #includestdio.h
 #includestring.h

 int fun(char *s)
 {
   int i,n;
 for(i=0;s[i]!='\0';i++);
 i=i-1;
 n=0;
 while(i=0)
 {
n=10*n+(s[i]-'0');
i--;
 }
 return n;
 }
 void add(char *p,char *q,char *r)
 {
  int c=0,i,temp;

  for(i=0;p[i]!='\0'q[i]!='\0';i++)
  {
temp=p[i]-'0'+q[i] -'0' +c;
r[i]=temp%10+'0';
c=temp/10;
  }
   while(p[i]!='\0')
  {
   temp=p[i]-'0'+c;
   r[i]=temp%10+'0';
   c=temp/10;
   i++;
  }
   while(q[i]!='\0')
  {
   temp=q[i]-'0'+c;
   r[i]=temp%10+'0';
   c=temp/10;
   i++;
  }
  while(c!=0)
  {
 r[i]=c+'0';
 c=c/10;
 i++;
  }
  r[i]='\0';

 }

 main()
 {  char
 one[2000]=1,zone[2000]=0,dzero[2000]=0,ans[1005][2000],k[2000],l[2000],m[2000];

   int i,n,f,uo,oop;
   char s[6];;

   ans[0][0]='0';

   for(i=1;i=999;i++)
   {
strcpy(k,one);

strcpy(l,zone);

strcpy(m,dzero);

add(k,m,zone);


add(zone,l,one);

strcpy(dzero,l);

oop=0;

   uo=strlen(dzero);

   for(f=uo-1;f=0;f--)
   ans[i][oop++]=dzero[f];
ans[i][oop]='\0';

   }
   while( (scanf(%s,s))!=EOF )
   {

   n=fun(s);

   printf(%s\n,ans[n]);

   }

   return 0;
 }

 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @MNNIT ALLAHABAD*

  --
 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.




-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
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

2011-08-06 Thread UTKARSH SRIVASTAV
difference between 64-bit compiler and 64-bit operating
system..sizeof any data type depends on compiler or operating
system

-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
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

2011-08-06 Thread hary rathor
in a 64 bit computer is that is capable of transfer 64 bit at a time
64 bit os means it capable of handle these 64 bit at time .but 32 it os use
only half of bus
so theorytically not practically 64 bit is 8 time faster than 32 bit os .
and 64 bit os can address more ram  at time .
cause of wide 64 bit address bus. this architecture is called x-64 based bit
and 32 bit os is called x-86 based architecture.
as we know that when be some compiler  are capable of install on both type
of os 32 and 64. that compiler will use 32 bit based
addressing system that result sizeof address 4 byte. if your compiler is
completely build for 64 bit os that definitely it has to use
64 bit address lan that require 8 byte size integer size to hold this wide
address.

so there for 3 type of os is available in market

x86
x64
x86 x64

now Windows 8 will come with 128 bit addressing system

i hope this can make you more clear

-- 
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

2011-08-05 Thread Vijay Khandar
What errors are you likely to get when you run the following program?

#includestdio.h
#includeconio.h
#includestring.h
void main()
{
clrscr();
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0;i=3;i++)
scanf(%s %f,e[i].name,e[i].sal);
getch();
}

Plz Explain anyone.

Vijay..

-- 
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

2011-08-05 Thread Nikhil Gupta
Couldn't find any error.

On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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

2011-08-05 Thread Vijay Khandar
What errors are you likely to get when you run the following program?

#includestdio.h
#includeconio.h
#includestring.h
void main()
{
clrscr();
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0;i=3;i++)
scanf(%s %f,e[i].name,e[i].sal);
getch();
}

A)floating point format not linked
B)Suspicious pointer conversion
C)Cannot use scanf() for structures
D)Strings cannot be nested inside structures

Plz Explain anyone.

Vijay.

-- 
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

2011-08-05 Thread Vijay Khandar
But program is not working properly...

On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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

2011-08-05 Thread Nikhil Gupta
http://www.ideone.com/ZIibX

The changes I have done in the program are to make it compatible to gcc
compiler.
Check the statement in the bottom of the page.

On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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.




-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
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

2011-08-05 Thread SANDEEP CHUGH
ITS (A). BECAUSE WE HAVE TO LINK THE EMULATOR AS COMPILER SEES A  REFERENCE
TO  FLOATING POINT NUMBER IT SETS ITS FLAG TO HAVE THE LINKER LINK INT THE
EMULATOR.. ITS IN 16 BIT COMPILER BECAUSE THERE IS NO PROVISION FOR FLOATING
POINT OPERATIONS IN 16 BIT MICRO PROCESSOR..SO THEY USE FLOATING POINT
EMULATOR... NOT IN VC++


On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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

2011-08-05 Thread Vijay Khandar
But program is not giving the o/p.
I have taken one printf statement same as scanf..and scanf() taking i/p
but prinf() not giving o/p...

On Fri, Aug 5, 2011 at 5:53 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/ZIibX

 The changes I have done in the program are to make it compatible to gcc
 compiler.
 Check the statement in the bottom of the page.

 On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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

2011-08-05 Thread SANDEEP CHUGH
INCLUDE THIS FUNCTION
linkfloat( )
{
float a = , *b ;
b = a ;  /* cause emulator to be linked */
a = *b ;/* suppress the warning - variable not used */
};

On Fri, Aug 5, 2011 at 6:04 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 But program is not giving the o/p.
 I have taken one printf statement same as scanf..and scanf() taking i/p
 but prinf() not giving o/p...


 On Fri, Aug 5, 2011 at 5:53 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/ZIibX

 The changes I have done in the program are to make it compatible to gcc
 compiler.
 Check the statement in the bottom of the page.

 On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.


-- 
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

2011-08-05 Thread Dipankar Patro
try doing this way and tell if the program is working properly now:
for (i=0; i3; i++)
{
 scanf(%[^\n], e[i].name);
 scanf(%f, e[i].sal);
}

There is always some problem in string input using %s, don't really know why
though deeply.

On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.




-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers = Save Trees

-- 
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

2011-08-05 Thread Vijay Khandar
I include this fn linkfloat(), Now my program working properlybut
why we have to include this fn externally plz explain.

On Fri, Aug 5, 2011 at 6:07 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:

 INCLUDE THIS FUNCTION
 linkfloat( )
 {
 float a = , *b ;
 b = a ;  /* cause emulator to be linked */
 a = *b ;/* suppress the warning - variable not used */
 };

 On Fri, Aug 5, 2011 at 6:04 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 But program is not giving the o/p.
 I have taken one printf statement same as scanf..and scanf() taking
 i/p but prinf() not giving o/p...


 On Fri, Aug 5, 2011 at 5:53 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/ZIibX

 The changes I have done in the program are to make it compatible to gcc
 compiler.
 Check the statement in the bottom of the page.

 On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.


  --
 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

2011-08-05 Thread Rohit Srivastava
you might get error: floating pointing formats not linked!!
but thats obsolete! I don't compiler these days will give such an error
otherwise code written by Dipankar will solve ur problem if u r unable to
take multi-word input
On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.com wrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 --
 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

2011-08-05 Thread Rohit Srivastava
which compiler are u using
?

On Fri, Aug 5, 2011 at 7:29 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 I include this fn linkfloat(), Now my program working properlybut
 why we have to include this fn externally plz explain.


 On Fri, Aug 5, 2011 at 6:07 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:

 INCLUDE THIS FUNCTION
 linkfloat( )
 {
 float a = , *b ;
 b = a ;  /* cause emulator to be linked */
 a = *b ;/* suppress the warning - variable not used */
 };

 On Fri, Aug 5, 2011 at 6:04 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 But program is not giving the o/p.
 I have taken one printf statement same as scanf..and scanf() taking
 i/p but prinf() not giving o/p...


 On Fri, Aug 5, 2011 at 5:53 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 http://www.ideone.com/ZIibX

 The changes I have done in the program are to make it compatible to gcc
 compiler.
 Check the statement in the bottom of the page.

 On Fri, Aug 5, 2011 at 5:46 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 A)floating point format not linked
 B)Suspicious pointer conversion
 C)Cannot use scanf() for structures
 D)Strings cannot be nested inside structures

 Plz Explain anyone.

 Vijay.

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.


  --
 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.


-- 
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

2011-08-05 Thread Vijay Khandar
Yes correct,  In m using very old compiler Turbo C++

On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava access2ro...@gmail.comwrote:

 you might get error: floating pointing formats not linked!!
 but thats obsolete! I don't compiler these days will give such an error
 otherwise code written by Dipankar will solve ur problem if u r unable to
 take multi-word input
 On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.comwrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.comwrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar 
 vijaykhand...@gmail.comwrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 --
 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.


-- 
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

2011-08-05 Thread Rohit Srivastava
try using dev or any new 32bit compiler it wont give that error!!!
or try using this
void linkfloat(void)
{
 float a=0,*b=a;
 a=*b;
}
this code forces the emulator to be linked
On Fri, Aug 5, 2011 at 7:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 Yes correct,  In m using very old compiler Turbo C++


 On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava 
 access2ro...@gmail.comwrote:

 you might get error: floating pointing formats not linked!!
 but thats obsolete! I don't compiler these days will give such an error
 otherwise code written by Dipankar will solve ur problem if u r unable to
 take multi-word input
 On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.comwrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta nikhilgupta2...@gmail.com
  wrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar vijaykhand...@gmail.com
  wrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 --
 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.


  --
 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

2011-08-05 Thread Vijay Khandar
Yes due to this only i m getting proper o/p, but why it is necessary in
Turbo C++ compiler.?

On Fri, Aug 5, 2011 at 7:41 PM, Rohit Srivastava access2ro...@gmail.comwrote:

 try using dev or any new 32bit compiler it wont give that error!!!
 or try using this
 void linkfloat(void)
 {
  float a=0,*b=a;
  a=*b;
 }
 this code forces the emulator to be linked
 On Fri, Aug 5, 2011 at 7:38 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 Yes correct,  In m using very old compiler Turbo C++


 On Fri, Aug 5, 2011 at 7:34 PM, Rohit Srivastava 
 access2ro...@gmail.comwrote:

 you might get error: floating pointing formats not linked!!
 but thats obsolete! I don't compiler these days will give such an error
 otherwise code written by Dipankar will solve ur problem if u r unable to
 take multi-word input
 On Fri, Aug 5, 2011 at 7:24 PM, Dipankar Patro dip10c...@gmail.comwrote:

 try doing this way and tell if the program is working properly now:
 for (i=0; i3; i++)
 {
  scanf(%[^\n], e[i].name);
  scanf(%f, e[i].sal);
 }

 There is always some problem in string input using %s, don't really know
 why though deeply.

 On 5 August 2011 17:48, Vijay Khandar vijaykhand...@gmail.com wrote:

 But program is not working properly...


 On Fri, Aug 5, 2011 at 5:44 PM, Nikhil Gupta 
 nikhilgupta2...@gmail.com wrote:

 Couldn't find any error.

 On Fri, Aug 5, 2011 at 5:38 PM, Vijay Khandar 
 vijaykhand...@gmail.com wrote:

 What errors are you likely to get when you run the following program?

 #includestdio.h
 #includeconio.h
 #includestring.h
 void main()
 {
 clrscr();
 struct emp
 {
 char name[20];
 float sal;
 };
 struct emp e[10];
 int i;
 for(i=0;i=3;i++)
 scanf(%s %f,e[i].name,e[i].sal);
 getch();
 }

 Plz Explain anyone.

 Vijay..

 --
 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.




 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

  --
 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.




 --

 ___

 Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 --
 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.


  --
 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.


-- 
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

2011-07-28 Thread sylvester
Given two integers A  B. Determine how many bits required to convert
A to B. Write a function int BitSwapReqd(int A, int B);

-- 
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

2011-07-28 Thread Rajeshwar Patra
just perform the xor operation on A and B
the number of 1's give the no of bits required...
Correct me if i am wrong

-- 
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

2011-07-27 Thread Vijay Khandar
#includestdio.h
#includeconio.h
void main()
{
clrscr();
int x=1,y=1,z=1;
x+=y+=z;
printf(\n %d\n ,xy?y:x);
printf(\n %d\n,xy?x++:y++);
printf(\n %d %d\n,x,y);
printf(\n %d\n,z+=xy?x++:y++);
printf(\n %d %d %d\n,x,y,z);
x=3;y=z=4;
printf(\n %d\n,z=y=x?1:0);
printf(\n %d\n,z=yy=x);
getch();
}

I m getting o/p as--
3
2
3 3
4
3 4 4
0
1

 I m confusing fm fourth printf...plz explain me..

Vijay.

-- 
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

2011-07-27 Thread aditi garg
C i guess ur comfortable wid the frst 3...
now in fourth c the order of evaluation frst xy is evaluated as   has
higher precedence that +=...since both r 3...so condition is false and y++
is taken...so z+=y++ takes place...
z ws 1 and y=3...so z becomes 4 and it is printed... and after this y
becomes 4... and since x++ ws not evaluated it retains its value of 3...
in the next one z=y takes place frst( associativity of = is left to right)
,since it is true it become 1 now 1=x is false hence ans 0...
in the last both z=y and y=x are true hence 1
i hope it is clear...


hence the ans 3 4 4 fr the next printf

On Wed, Jul 27, 2011 at 9:33 PM, Vijay Khandar vijaykhand...@gmail.comwrote:

 #includestdio.h
 #includeconio.h
 void main()
 {
 clrscr();
 int x=1,y=1,z=1;
 x+=y+=z;
 printf(\n %d\n ,xy?y:x);
 printf(\n %d\n,xy?x++:y++);
 printf(\n %d %d\n,x,y);
 printf(\n %d\n,z+=xy?x++:y++);
 printf(\n %d %d %d\n,x,y,z);
 x=3;y=z=4;
 printf(\n %d\n,z=y=x?1:0);
 printf(\n %d\n,z=yy=x);
 getch();
 }

 I m getting o/p as--
 3
 2
 3 3
 4
 3 4 4
 0
 1

  I m confusing fm fourth printf...plz explain me..

 Vijay.

 --
 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.




-- 
Aditi Garg
Undergraduate Student
Electronics  Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

9718388816

-- 
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

2011-07-27 Thread Janet Bernosky
How can I stop getting emails from this group  I went on your site to look 
up one thing, and now I am getting all this STUFF I don't want...Please help...


--- On Wed, 7/27/11, aditi garg aditi.garg.6...@gmail.com wrote:


From: aditi garg aditi.garg.6...@gmail.com
Subject: Re: [algogeeks] Question
To: algogeeks@googlegroups.com
Date: Wednesday, July 27, 2011, 4:48 PM


C i guess ur comfortable wid the frst 3...
now in fourth c the order of evaluation frst xy is evaluated as   has higher 
precedence that +=...since both r 3...so condition is false and y++ is 
taken...so z+=y++ takes place...
z ws 1 and y=3...so z becomes 4 and it is printed... and after this y becomes 
4... and since x++ ws not evaluated it retains its value of 3...
in the next one z=y takes place frst( associativity of = is left to right) 
,since it is true it become 1 now 1=x is false hence ans 0...
in the last both z=y and y=x are true hence 1
i hope it is clear...




hence the ans 3 4 4 fr the next printf


On Wed, Jul 27, 2011 at 9:33 PM, Vijay Khandar vijaykhand...@gmail.com wrote:

#includestdio.h
#includeconio.h
void main()
{
clrscr();
int x=1,y=1,z=1;
x+=y+=z;
printf(\n %d\n ,xy?y:x);
printf(\n %d\n,xy?x++:y++);
printf(\n %d %d\n,x,y);
printf(\n %d\n,z+=xy?x++:y++);
printf(\n %d %d %d\n,x,y,z);
x=3;y=z=4;
printf(\n %d\n,z=y=x?1:0);
printf(\n %d\n,z=yy=x);
getch();
}

I m getting o/p as--
3
2
3 3
4
3 4 4
0
1

 I m confusing fm fourth printf...plz explain me..

Vijay.

--
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.




-- 

Aditi Garg
Undergraduate Student
Electronics  Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi


9718388816

-- 
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

2011-07-27 Thread SkRiPt KiDdIe
use unsubscribe link at bottom of mail.

-- 
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

2011-07-25 Thread sagar pareek
A man leaves office daily at 7pm.a driver with car comes from his home
to pick him from office and bring back home. One day he gets free at
5.30 and instead of waiting for driver he starts walking towards home.
In the wayhe meets the car and returns home on car. He reaches home 20
minutes earlier than usual. In how much time does the man reach home
usually?
(A) 1 hr 20 min (B) 1 hr(C) 1 hr 10 min(D) 55 min





-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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

2011-07-25 Thread AASHISH SUMAN
@sagar :: this group is for programming concepts not for apti.. if u
wana to post some apti or reasoning question post here..
http://www.facebook.com/groups/150933398312351?ap=1
-- 
*WITH BEST REGARDS :

AASHISH SUMAN
MCA FINAL YEAR
*
*NIT DURGAPUR*
*+91-9547969906*

-- 
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

2011-07-25 Thread shady
easy guys...

@sagar nice question, if there had been an option for incomplete info, i
would have gone with that... but it made me think thoroughly :)  80 min. is
answer

@aashish we are forming new group for apti kind of questions...

On Mon, Jul 25, 2011 at 10:23 PM, AASHISH SUMAN
aashish.barn...@gmail.comwrote:


 @sagar :: this group is for programming concepts not for apti.. if u
 wana to post some apti or reasoning question post here..
 http://www.facebook.com/groups/150933398312351?ap=1
 --
 *WITH BEST REGARDS :

 AASHISH SUMAN
 MCA FINAL YEAR
 *
 *NIT DURGAPUR*
 *+91-9547969906*

  --
 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.



  1   2   >