Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread Vicki Wen
@ bharat: merging 2 sorted arrays is O(n) On Tue, Sep 13, 2011 at 12:42 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > @jai gupta : merge sort for 2 sorted arrays --O(nlogn) right? > > > On Tue, Sep 13, 2011 at 1:03 PM, jai gupta wrote: > >> @bharat: When each step of nishant

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread bharatkumar bagana
@jai gupta : merge sort for 2 sorted arrays --O(nlogn) right? On Tue, Sep 13, 2011 at 1:03 PM, jai gupta wrote: > @bharat: When each step of nishant's algo is O(n) how can it sum up to > O(nlogn)??? > > On Tue, Sep 13, 2011 at 9:18 AM, bharatkumar bagana < > bagana.bharatku...@gmail.com> wrote:

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-13 Thread jai gupta
@bharat: When each step of nishant's algo is O(n) how can it sum up to O(nlogn)??? On Tue, Sep 13, 2011 at 9:18 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > @nishant : your algo takes O(nlogn) time with higher constant behind > this. can't we write better than this ? > @sa

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-12 Thread bharatkumar bagana
@nishant : your algo takes O(nlogn) time with higher constant behind this. can't we write better than this ? @sairam : will u pls provide implementation logic of u'r idea .. On Mon, Sep 12, 2011 at 12:43 PM, Sairam Ravu wrote: > By merging smaller trees into larger trees we can obtain a muc

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-12 Thread Sairam Ravu
By merging smaller trees into larger trees we can obtain a much more efficient solution. -- With love and regards, Sairam Ravu I M. Tech(CS) Sri Sathya Sai Institute of Higher Learning "To live life, you must think it, measure it, experiment with it, dance it, paint it, draw it, and calculate

Re: [algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-11 Thread nishaanth
convert the binary search tree into a sorted linked list. After flattening construct the tree out of it. And please don't use capital letters unnecessarily. It reflects bad on you. On Sun, Sep 11, 2011 at 7:29 AM, teja bala wrote: > MERGE 2 BINARY SEARCH TREES? > > > HOW TO DO IT?(POST AN EFFICI

[algogeeks] MICROSOFT WRITTEN QUESTION-2010

2011-09-11 Thread teja bala
MERGE 2 BINARY SEARCH TREES? HOW TO DO IT?(POST AN EFFICIENT ALGORITHM) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeek

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
No. I think you should revisit complexity. That's not how it works. Factoring a million digit number outputs two numbers. It should take O(1), right? :D On Sat, Sep 10, 2011 at 11:56 AM, Neha Singh wrote: > we hv to just fill an array of size n, so complexity should be O(n) in worst > case > > -

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Neha Singh
we hv to just fill an array of size n, so complexity should be O(n) in worst case -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
On Sat, Sep 10, 2011 at 11:28 AM, teja bala wrote: > @Gaurav > > wat if here is n=1 > den >  W(0)=? > >  i dint get that See, when you get to W(0) state, that means, you have created a valid combination. That means, you have gone through one 'path' through the various possibilities. That is why W

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
@Gaurav wat if here is n=1 den W(0)=? i dint get that -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@g

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
On Sat, Sep 10, 2011 at 11:22 AM, Neha Singh wrote: > O(n/a) For every n, it would add values for W(n-v1), W(n-v2),..., W(n-vm), if there are m denominations of coins. So the complexity would be O(nm). Also, this can be implemented in two ways. Top-down (which is what I mentioned), and Bottom-up.

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Neha Singh
O(n/a) where n is the required sum which is to be created by grouping the coins and a is the coin of smallest denomination so, O(n) in the worst case -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge

Re: [algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread Gaurav Menghani
You can use a trivial dynamic programming for this. Let W(n) be the number of ways to create n rupees, then W(n) = W(n-1) + W(n-5) + W(n-10) + W(n-25) + W(n-50) if(n<0) then W(n) = 0 if(n==0) then W(n) = 1 What do you think would be the complexity of this solution? On Sat, Sep 10, 2011 at 10:57

[algogeeks] MICROSOFT WRITTEN QUESTION

2011-09-10 Thread teja bala
There are set of coins of {50,25,10,5,1} paise in a box.Write a program to find the number of ways a 1 rupee can be created by grouping the paise. post ur code. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this g