Re: [algogeeks] Imp-Amazon Question

2011-10-02 Thread Preetam Purbia
you can implement using hashmap..

On Mon, Oct 3, 2011 at 12:51 AM, Ankur Garg ankurga...@gmail.com wrote:

 Define a data structure , using extra memory/space , such that :



 Insert(int a)

 Delete(int a)

 isPresent(int a)

 get(int a)



 All above operations on the defined data structure take O(1) , i.e.
 constant time.



 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@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.



Re: [algogeeks] Complexity Help ??

2011-01-22 Thread Preetam Purbia
T(n) = T(n-1) + T(n-2) + O(1)


On Sat, Jan 22, 2011 at 11:28 PM, Decipher ankurseth...@gmail.com wrote:

 Could u pls explain ??

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm 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.



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.