[algogeeks] Re: Building A Special Tree

2011-01-20 Thread bittu
@juver++..write ur algo..   i will see that..


Thanks  Regards
Shashank Mani

-- 
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] C++ Doubt

2011-01-20 Thread Decipher
When we can convert Derived* to Base* then why can't we convert Derived** to 
Base** ??

-- 
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] Microsoft - DP problem

2011-01-20 Thread Decipher


There is a row of houses in which each house contains some amount of money. 
Write an algorithm that loots the maximum amount of money from these houses. 
The only restriction is that you cannot loot two houses that are directly 
next to each other.

-- 
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] Re: Microsoft - DP problem

2011-01-20 Thread juver++
dp[i][flag] - max amount up to the i-th house (i-th house is included into 
final result if flag = true).

-- 
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] Microsoft - DP problem

2011-01-20 Thread Manmeet Singh
It can be done in O(n) space too using DP :) :).
U dont need that flag, but that solution u said is absolutely correct.
On Thu, Jan 20, 2011 at 7:27 PM, Decipher ankurseth...@gmail.com wrote:

 There is a row of houses in which each house contains some amount of money.
 Write an algorithm that loots the maximum amount of money from these houses.
 The only restriction is that you cannot loot two houses that are directly
 next to each other.

  --
 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.comalgogeeks%2bunsubscr...@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] Re: Google Question

2011-01-20 Thread abhijith reddy d
I think its correct.

On Jan 19, 9:35 pm, nishaanth nishaant...@gmail.com wrote:
 How about the following dynamic programming solution.

 Let dp[i] be the max no of As with i keystrokes.

 dp[i]=max(dp[i-1]+1,2*dp[i-3])

 dp[N] is the required solution.

 Correct me if i am wrong.



 On Wed, Jan 19, 2011 at 9:20 PM, Raj rajmangaltiw...@gmail.com wrote:
 http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html

  On Jan 19, 8:28 pm, bittu shashank7andr...@gmail.com wrote:
   Given

   1. A
   2. Ctrl+A
   3. Ctrl+C
   4. Ctrl+V

   If you can only press the keyboard for N times (with the above four
   keys), please write a program to produce maximum numbers of A. If
   possible, please also print out the sequence of keys.

   So the input parameter is N (No. of keys that you can press), the
   output is M (No. of As that you can produce).

   Thanks  Regards
   Shashank Mani

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

 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

-- 
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] C++ Doubt

2011-01-20 Thread yq Zhang
The reason is simple. The same thing happen in other language such as JAVA.
You can convert Derived class to Base class but you can't convert Derived[]
to Base[]. The reason is, if your Base class has two derived classes D1, D2.
They can exist in Base[] because D1, D2 are valid Base instances. While you
doing converting from Base[] to D1[], it's not possible, because in Base
there are other D2 instances. To avoid these common mistakes, converting
from Derived[] to Base[] it not allowed.

Yq

On Thu, Jan 20, 2011 at 5:54 AM, Decipher ankurseth...@gmail.com wrote:

 When we can convert Derived* to Base* then why can't we convert Derived**
 to Base** ??

 --
 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.comalgogeeks%2bunsubscr...@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] Re: Microsoft - DP problem

2011-01-20 Thread Davin
static int MaxLoot(int[] A, int n)
{
int[] S = new int[n];
S[0] = A[0];
S[1] = A[1];
S[2] = S[0] + A[2];


int maxloot = Math.Max(S[1], S[2]);



for (int i = 3; i  n; i++)
{
S[i] = Math.Max(S[i - 2], S[i - 3]) + A[i];
maxloot = Math.Max(maxloot, S[i]);
}



return maxloot;
}

On Jan 20, 7:30 pm, Manmeet Singh mans.aus...@gmail.com wrote:
 It can be done in O(n) space too using DP :) :).
 U dont need that flag, but that solution u said is absolutely correct.







 On Thu, Jan 20, 2011 at 7:27 PM, Decipher ankurseth...@gmail.com wrote:
  There is a row of houses in which each house contains some amount of money.
  Write an algorithm that loots the maximum amount of money from these houses.
  The only restriction is that you cannot loot two houses that are directly
  next to each other.

   --
  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.comalgogeeks%2Bunsubscribe@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] C++ Doubt

2011-01-20 Thread Avi Dullu
extending the above example

Base B;

DerivedClasses D1, D2;

B's content   - {content_of_B }
D1's content - { content_of_B, D1_specific_data_and_functions}
D2's content - { content_of_B, D2_specific_data_and_functions}

Can you see the reason now? The above is a very simplified example, think of
virtual classes too :).


Programmers should realize their critical importance and responsibility in a
world gone digital. They are in many ways similar to the priests and monks
of Europe's Dark Ages; they are the only ones with the training and insight
to read and interpret the scripture of this age.


On Thu, Jan 20, 2011 at 10:21 PM, yq Zhang zhangyunq...@gmail.com wrote:

 The reason is simple. The same thing happen in other language such as JAVA.
 You can convert Derived class to Base class but you can't convert Derived[]
 to Base[]. The reason is, if your Base class has two derived classes D1, D2.
 They can exist in Base[] because D1, D2 are valid Base instances. While you
 doing converting from Base[] to D1[], it's not possible, because in Base
 there are other D2 instances. To avoid these common mistakes, converting
 from Derived[] to Base[] it not allowed.

 Yq


 On Thu, Jan 20, 2011 at 5:54 AM, Decipher ankurseth...@gmail.com wrote:

 When we can convert Derived* to Base* then why can't we convert Derived**
 to Base** ??

 --
 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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@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] Re: probability

2011-01-20 Thread nishaanth
Simple Conditional probability formula...Ans B)

On Fri, Jan 14, 2011 at 9:04 PM, Jammy xujiayiy...@gmail.com wrote:

 Bayes' theorem: 
 http://en.wikipedia.org/wiki/Bayes'_theoremhttp://en.wikipedia.org/wiki/Bayes%27_theorem
 P(x=even|x3) = P(x3|x=even)*P(x=even)/P(x3)===B

 On Jan 14, 2:29 am, snehal jain learner@gmail.com wrote:
  An unbalanced dice (with 6 faces, numbered from 1 to 6) is thrown. The
  probability that the face value is odd is 90% of the probability that
  the face value
  is even. The probability of getting any even numbered face is the
  same.
  If the probability that the face is even given that it is greater than
  3 is 0.75,
  which one of the following options is closest to the probability that
  the face value
  exceeds 3?
  (A) 0.453 (B) 0.468 (C) 0.485 (D) 0.492

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




-- 
S.Nishaanth,
Computer Science and engineering,
IIT Madras.

-- 
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] Adobe Question

2011-01-20 Thread nishaanth
Ya as Ashish said hashing is the best solution :)

On Fri, Jan 14, 2011 at 6:00 PM, Ashish Goel ashg...@gmail.com wrote:

 ideally, a hashMap would be preferred

 walk through one array and set the corresponding entry, and then through
 another array, if any entry found, then they are not disjoint.

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Fri, Jan 14, 2011 at 3:35 PM, bittu shashank7andr...@gmail.com wrote:

 how to find if two arrays of size n are disjoint or not in O(n)
 time ?? You can use only O(n) space
 The elements are +ve in the range 0 to n power 100..



 Regards
 Shashank Mani

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




-- 
S.Nishaanth,
Computer Science and engineering,
IIT Madras.

-- 
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] Re: Microsoft - DP problem

2011-01-20 Thread Avi Dullu
@^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally*
very strict about such mistakes :)


Programmers should realize their critical importance and responsibility in a
world gone digital. They are in many ways similar to the priests and monks
of Europe's Dark Ages; they are the only ones with the training and insight
to read and interpret the scripture of this age.


On Thu, Jan 20, 2011 at 11:05 PM, Davin dkthar...@googlemail.com wrote:

 static int MaxLoot(int[] A, int n)
{
int[] S = new int[n];
S[0] = A[0];
S[1] = A[1];
S[2] = S[0] + A[2];


int maxloot = Math.Max(S[1], S[2]);



for (int i = 3; i  n; i++)
{
S[i] = Math.Max(S[i - 2], S[i - 3]) + A[i];
maxloot = Math.Max(maxloot, S[i]);
}



return maxloot;
 }

 On Jan 20, 7:30 pm, Manmeet Singh mans.aus...@gmail.com wrote:
  It can be done in O(n) space too using DP :) :).
  U dont need that flag, but that solution u said is absolutely correct.
 
 
 
 
 
 
 
  On Thu, Jan 20, 2011 at 7:27 PM, Decipher ankurseth...@gmail.com
 wrote:
   There is a row of houses in which each house contains some amount of
 money.
   Write an algorithm that loots the maximum amount of money from these
 houses.
   The only restriction is that you cannot loot two houses that are
 directly
   next to each other.
 
--
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2Bunsubscribe@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.comalgogeeks%2bunsubscr...@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] Re: Microsoft - DP problem

2011-01-20 Thread Manmeet Singh
I dnt get the iterative version. Can u explain it. I can do it top down in
O(n) with state index
 I am at.
On Thu, Jan 20, 2011 at 11:30 PM, Avi Dullu avi.du...@gmail.com wrote:

 @^ Just check ur solution for boundary case ( n = 2) .. M$ is *generally*
 very strict about such mistakes :)


 Programmers should realize their critical importance and responsibility in
 a world gone digital. They are in many ways similar to the priests and monks
 of Europe's Dark Ages; they are the only ones with the training and insight
 to read and interpret the scripture of this age.



 On Thu, Jan 20, 2011 at 11:05 PM, Davin dkthar...@googlemail.com wrote:

 static int MaxLoot(int[] A, int n)
{
int[] S = new int[n];
S[0] = A[0];
S[1] = A[1];
S[2] = S[0] + A[2];


int maxloot = Math.Max(S[1], S[2]);



for (int i = 3; i  n; i++)
{
S[i] = Math.Max(S[i - 2], S[i - 3]) + A[i];
maxloot = Math.Max(maxloot, S[i]);
}



return maxloot;
 }

 On Jan 20, 7:30 pm, Manmeet Singh mans.aus...@gmail.com wrote:
  It can be done in O(n) space too using DP :) :).
  U dont need that flag, but that solution u said is absolutely correct.
 
 
 
 
 
 
 
  On Thu, Jan 20, 2011 at 7:27 PM, Decipher ankurseth...@gmail.com
 wrote:
   There is a row of houses in which each house contains some amount of
 money.
   Write an algorithm that loots the maximum amount of money from these
 houses.
   The only restriction is that you cannot loot two houses that are
 directly
   next to each other.
 
--
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2Bunsubscribe@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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@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] Citrix System

2011-01-20 Thread Decipher
Write a program which prints all the combination of 10 A's and 10 B's .

-- 
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] Re: Citrix System

2011-01-20 Thread juver++
1.
int const SIZE = 20;
int const MAX_MASK = (1  20);
FOR (set, MAX_MASK) {
  int a = amount of 1's in the set;
  if (a == SIZE / 2) print set;
}

2. int current = (1  10) - 1; // set is ...A...BBB
int max = (1  20) - 1 - current;
while (current != LARGE) {
print set;
current = next smallest number with the same number of 1's
}

3. recursive solution

-- 
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] Re: Google Question

2011-01-20 Thread Saikat Debnath
According to me Nishaanth's solution is incorrect, as let for n =10, your
output : m=16
but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.

On Thu, Jan 20, 2011 at 9:24 PM, abhijith reddy d
abhijith200...@gmail.comwrote:

 I think its correct.

 On Jan 19, 9:35 pm, nishaanth nishaant...@gmail.com wrote:
  How about the following dynamic programming solution.
 
  Let dp[i] be the max no of As with i keystrokes.
 
  dp[i]=max(dp[i-1]+1,2*dp[i-3])
 
  dp[N] is the required solution.
 
  Correct me if i am wrong.
 
 
 
  On Wed, Jan 19, 2011 at 9:20 PM, Raj rajmangaltiw...@gmail.com wrote:
  http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html
 
   On Jan 19, 8:28 pm, bittu shashank7andr...@gmail.com wrote:
Given
 
1. A
2. Ctrl+A
3. Ctrl+C
4. Ctrl+V
 
If you can only press the keyboard for N times (with the above four
keys), please write a program to produce maximum numbers of A. If
possible, please also print out the sequence of keys.
 
So the input parameter is N (No. of keys that you can press), the
output is M (No. of As that you can produce).
 
Thanks  Regards
Shashank Mani
 
   --
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  S.Nishaanth,
  Computer Science and engineering,
  IIT Madras.

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




-- 
Regards
Saikat Kumar Debnath
IIIrd year, Computer Science Deptt.,
Delhi Technological University,
(formerly Delhi College of Engineering)
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Google Question

2011-01-20 Thread Anand
but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.

Try this on a notepad. you will only 15A's

On Thu, Jan 20, 2011 at 12:46 PM, Saikat Debnath saikat@gmail.comwrote:

 According to me Nishaanth's solution is incorrect, as let for n =10, your
 output : m=16
 but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
 resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.


 On Thu, Jan 20, 2011 at 9:24 PM, abhijith reddy d 
 abhijith200...@gmail.com wrote:

 I think its correct.

 On Jan 19, 9:35 pm, nishaanth nishaant...@gmail.com wrote:
  How about the following dynamic programming solution.
 
  Let dp[i] be the max no of As with i keystrokes.
 
  dp[i]=max(dp[i-1]+1,2*dp[i-3])
 
  dp[N] is the required solution.
 
  Correct me if i am wrong.
 
 
 
  On Wed, Jan 19, 2011 at 9:20 PM, Raj rajmangaltiw...@gmail.com wrote:
  http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html
 
   On Jan 19, 8:28 pm, bittu shashank7andr...@gmail.com wrote:
Given
 
1. A
2. Ctrl+A
3. Ctrl+C
4. Ctrl+V
 
If you can only press the keyboard for N times (with the above four
keys), please write a program to produce maximum numbers of A. If
possible, please also print out the sequence of keys.
 
So the input parameter is N (No. of keys that you can press), the
output is M (No. of As that you can produce).
 
Thanks  Regards
Shashank Mani
 
   --
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  S.Nishaanth,
  Computer Science and engineering,
  IIT Madras.

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




 --
 Regards
 Saikat Kumar Debnath
 IIIrd year, Computer Science Deptt.,
 Delhi Technological University,
 (formerly Delhi College of Engineering)
 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.comalgogeeks%2bunsubscr...@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] Need ....................SAP Requirements.................CA

2011-01-20 Thread Upender Gaadi
Please send profiles to upen...@erpanderp.com

Requirements:

 Position Title :SAP QM
 Start date  :ASAP
 Duration :Long term
 Location: Lebanon, NJ

Primary Skills :A minimum of  5 years of QM module experience is required
preferably SAP ECC6

Job Description :
Quality Management (QM) –  Onsite
QM consultant will handle the production support issues interacting directly
with users, develop solutions on QM requirements taking guidance from onsite
team members/ core team to resolve configuration / development issues.  In
addition perform Unit, string and QAS testing to complete the validation
requirements.
o A minimum of  5 years of QM module experience is required preferably SAP
ECC6.0
o Should possess excellent communication skills
o Must have good presentation skills
o Sound Knowledge of QM module and processes related to integration with
other modules covering the following areas:
QM in Procurement, Production and Delivery inspection, Inspection Plans with
multiple specifications, sample drawing procedure, sampling procedure, DMR
Rules, Quality Notifications,  Batch management, Digital signatures, Quality
Certificates and QM Interface with LIMS Systems.
o Working experience in trouble shooting production support issues is
desirable
o Experience in FDA regulated environment(s) / Pharma industry experience is
desirable
o Working experience in Quality notification workflow and  BI reporting will
be a plus.

Position Title: SAP ABAP+APO
Start date :ASAP
Duration  :Long term
Location: Richmond ,VA

Primary Skill :   VMI background is a must

Note :

Need SAP ABAP+APO
with good VMI background
Location is Need ASAP

Position Title: SAP BOBJ + Rapid Mart
Start date :ASAP
Location: Burbank, California

The resource is expected to have strong knowledge on SAP BO Rapidmart to be
able to provide application support. Knowledge of Service Center would be a
plus.



Upender.G
Recruiter

ERP and ERP Corp

48521 Warm Springs Blvd, Suite 307A,Fremont, CA 94539.
PH: 408-459-1681/ Fax: 775-201-9919
Email: upen...@erpanderp.com / www.erpanderp.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] Re: L values and r values

2011-01-20 Thread Gene
L and R values have great significance to language designers and compiler 
builders. They have some significance to language users, but most people 
don't have to think about them because the distinction is common sense.  

In your case,  operates on L-values and always produces an R-value. 
 Therefore (X) for any won't compile no matter what X is.


-- 
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] oldman wants to chat

2011-01-20 Thread oldman
---

oldman wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-769dc2752a-6e0a13f068-6VoQ4T-LSU9ZLrSQtN38SsrBB10
You'll need to click this link to be able to chat with oldman.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with oldman, visit:
http://mail.google.com/mail/a-769dc2752a-6e0a13f068-6VoQ4T-LSU9ZLrSQtN38SsrBB10

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into conversations
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
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] Re: Google Question

2011-01-20 Thread Preetam Purbia
Hi,

I think this method will work:

Possible Number of A's = N/2(1+R)
where R=N-(N/2+3)

assuming 11/2 = 5

Thanks
Preetam

On Fri, Jan 21, 2011 at 2:29 AM, Anand anandut2...@gmail.com wrote:

 but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
 resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.

 Try this on a notepad. you will only 15A's


 On Thu, Jan 20, 2011 at 12:46 PM, Saikat Debnath saikat@gmail.comwrote:

 According to me Nishaanth's solution is incorrect, as let for n =10, your
 output : m=16
 but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C
 resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20.


 On Thu, Jan 20, 2011 at 9:24 PM, abhijith reddy d 
 abhijith200...@gmail.com wrote:

 I think its correct.

 On Jan 19, 9:35 pm, nishaanth nishaant...@gmail.com wrote:
  How about the following dynamic programming solution.
 
  Let dp[i] be the max no of As with i keystrokes.
 
  dp[i]=max(dp[i-1]+1,2*dp[i-3])
 
  dp[N] is the required solution.
 
  Correct me if i am wrong.
 
 
 
  On Wed, Jan 19, 2011 at 9:20 PM, Raj rajmangaltiw...@gmail.com
 wrote:
  http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html
 
   On Jan 19, 8:28 pm, bittu shashank7andr...@gmail.com wrote:
Given
 
1. A
2. Ctrl+A
3. Ctrl+C
4. Ctrl+V
 
If you can only press the keyboard for N times (with the above four
keys), please write a program to produce maximum numbers of A. If
possible, please also print out the sequence of keys.
 
So the input parameter is N (No. of keys that you can press), the
output is M (No. of As that you can produce).
 
Thanks  Regards
Shashank Mani
 
   --
   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.comalgogeeks%2bunsubscr...@googlegroups.com
 algogeeks%2bunsubscr...@googlegroups.comalgogeeks%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  S.Nishaanth,
  Computer Science and engineering,
  IIT Madras.

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




 --
 Regards
 Saikat Kumar Debnath
 IIIrd year, Computer Science Deptt.,
 Delhi Technological University,
 (formerly Delhi College of Engineering)
 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.comalgogeeks%2bunsubscr...@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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Preetam Purbia
http://twitter.com/preetam_purbia

-- 
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] Maximize the Time to see TV

2011-01-20 Thread snehal jain
There is a TV avid person. HE wants to spend his max time on TV. There
are N channels with different program of different length and diff
times. WAP so that the person cam spend his max time watching TV.
Precondition: If that person watches a program, he watches it
completely.

Ex:
Channel1: prog1 – 8:00- 8:30
prog2: 9:00 – 10:00
prog3: 10:15 – 12:00

channel2: prg1 – 8:15 – 10:00
prg2: 10:30 – 12:00

So in this case max time will be if he watches:

ch2/prg1 + ch1/prg3

-- 
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] pairwise sum

2011-01-20 Thread snehal jain
If pairwise sums of ‘n’ numbers are given in non-decreasing order
identify the individual numbers. If the sum is corrupted print -1
Example:
i/p:
4
4 5 7 10 12 13

o/p:
1 3 4 9

-- 
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] Re: Maximize the Time to see TV

2011-01-20 Thread juver++
Simple DP is here. Problem is similar to maximum total length of 
non-intersected segments.

-- 
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] zig zag

2011-01-20 Thread snehal jain
A sequence of numbers is called a zig-zag sequence if the differences
between successive numbers strictly alternate between positive and
negative. The first difference (if one exists) may be either positive
or negative. A sequence with fewer than two elements is trivially a
zig-zag sequence.

For example, 1,7,4,9,2,5 is a zig-zag sequence because the differences
(6,-3,5,-7,3) are alternately positive and negative. In contrast,
1,4,7,2,5 and 1,7,4,5,5 are not zig-zag sequences, the first because
its first two differences are positive and the second because its last
difference is zero.

Given a sequence of integers, sequence, return the length of the
longest subsequence of sequence that is a zig-zag sequence. A
subsequence is obtained by deleting some number of elements (possibly
zero) from the original sequence, leaving the remaining elements in
their original order.

-- 
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] Ideal String

2011-01-20 Thread radha krishnan
Whats the range of length ?

On Fri, Jan 21, 2011 at 11:42 AM, snehal jain learner@gmail.com wrote:
 An ideal string is a string where the 1-based index of the first
 occurrence of each letter is equal to the number of occurrences of
 that letter in the string. For example, the “BAOOOA” is an ideal
 string (quotes for clarity only). The letter ‘B’ appears 1 time, and
 its index is 1. The letter ‘A’ occurs 2 times and its first index is
 2. The letter ‘O’ occurs 3 times and its first index is 3.

 Given an int length, return the lexicographical smallest ideal string
 of that length containing only uppercase letters (‘A’-'Z’). If there
 are no such ideal strings of that length, return an empty String
 instead.

 --
 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] Maximize the Time to see TV

2011-01-20 Thread Anand
Sort all program with their starting time.

Appy the below pseudo code to find max number of programs he can watch.

for(i=i;ilen;i++)
{
/*Check for overlap */
   if(p[i].start  p[i-1].end)
   {
end = i;
   }
   else
   {
  /*Index of the first program to be watch*/
  if((p[i-1].end - p[i-1].start)  (p[i].end - p[i].start))
  {
 start = i;
  }
   }

}
 return end - start;

On Thu, Jan 20, 2011 at 10:11 PM, snehal jain learner@gmail.com wrote:

 There is a TV avid person. HE wants to spend his max time on TV. There
 are N channels with different program of different length and diff
 times. WAP so that the person cam spend his max time watching TV.
 Precondition: If that person watches a program, he watches it
 completely.

 Ex:
 Channel1: prog1 – 8:00- 8:30
 prog2: 9:00 – 10:00
 prog3: 10:15 – 12:00

 channel2: prg1 – 8:15 – 10:00
 prg2: 10:30 – 12:00

 So in this case max time will be if he watches:

 ch2/prg1 + ch1/prg3

 --
 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.comalgogeeks%2bunsubscr...@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] zig zag

2011-01-20 Thread radha krishnan
See Topcoder Dynamic Programming Tutorials :)

On Fri, Jan 21, 2011 at 12:48 PM, snehal jain learner@gmail.com wrote:
 A sequence of numbers is called a zig-zag sequence if the differences
 between successive numbers strictly alternate between positive and
 negative. The first difference (if one exists) may be either positive
 or negative. A sequence with fewer than two elements is trivially a
 zig-zag sequence.

 For example, 1,7,4,9,2,5 is a zig-zag sequence because the differences
 (6,-3,5,-7,3) are alternately positive and negative. In contrast,
 1,4,7,2,5 and 1,7,4,5,5 are not zig-zag sequences, the first because
 its first two differences are positive and the second because its last
 difference is zero.

 Given a sequence of integers, sequence, return the length of the
 longest subsequence of sequence that is a zig-zag sequence. A
 subsequence is obtained by deleting some number of elements (possibly
 zero) from the original sequence, leaving the remaining elements in
 their original order.

 --
 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] power of 3

2011-01-20 Thread snehal jain
Given M, find if M = 3^x for some positive integer x efficiently. DO
NOT think of log, pow etc

-- 
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] Divide the array into groups

2011-01-20 Thread snehal jain
Divide a list of numbers into groups of consecutive numbers but their
original order should be preserved.
Example:
8,2,4,7,1,0,3,6
Two groups:
2,4,1,0,3 8,7,6
Better than O(n^2) is expected.

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