[algogeeks] Re: Cashbox withdrawal

2006-01-02 Thread pramod
This can be solved by Dynamic Programming. Let the denominations be d1,d2,...,dn and their corresponding numbers be P1,P2,...,Pn. Let C(n,S) be the matrix which tells us if the amount S can be obtained by using coins d1,...,dn. Then C(n,S) = C(n-1,S) if denomination dn is not used, else C(n,S) = C

[algogeeks] Cashbox withdrawal

2006-01-02 Thread kestrel
I have encountered a problem in my current project that seems pretty much related to the subset sum problem. I just want to make sure it is not a special case of the subset sum problem and whether it has a efficient solution or not. We are doing an application for tellers in a bank. The teller bas

[algogeeks] Re: Hard mathematical function

2006-01-02 Thread Michael Ageeb
This method does not have any stopping conditions it will loop foreverOn 1/2/06, leeight xjtu <[EMAIL PROTECTED] > wrote:function abc(int i){ return abc((i % 2 == 1) ? i * 3 + 1 : i / 2);} can you tell me WHY the result returnĀ  by the function abc is always 1, no matter what is i?2006/1/2, Peyman

[algogeeks] Re: Hard mathematical function

2006-01-02 Thread leeight xjtu
function abc(int i){ return abc((i % 2 == 1) ? i * 3 + 1 : i / 2);} can you tell me WHY the result returnĀ  by the function abc is always 1, no matter what is i?2006/1/2, Peyman < [EMAIL PROTECTED]>:Hi Saravana, Why don't you try to find Prime numbers? Recently, some indian guy,showed that Prime is

[algogeeks] Re: Sum of sub array

2006-01-02 Thread Mattia Merzi
On 1/2/06, Michael Ageeb <[EMAIL PROTECTED]> wrote: > Yes but this will consume O(n) time at the start of the algorithm as a > pre-calculations well, I probably didn't understand the initial problem, awfully sorry ! :) I thought that the calculation of the sum must be done in O(log n) or less, bu

[algogeeks] Re: Hard mathematical function

2006-01-02 Thread Peyman
Hi Saravana, Why don't you try to find Prime numbers? Recently, some indian guy, showed that Prime is not NP anymore, but still, there's quite a lot effort to find a new prime numbers that are huge! And it's useful in encryption.

[algogeeks] Fwd: LOAPS: Programmer Of The Month reminder

2006-01-02 Thread Sridhar Ratna
-- Forwarded message --From: [EMAIL PROTECTED] <[EMAIL PROTECTED] >Date: Jan 2, 2006 8:51 PMSubject: LOAPS: Programmer Of The Month reminderTo: [EMAIL PROTECTED] Happy New Year friends - I'm hoping one of your resolutions is to write a program for the Programmer Of The Month con

[algogeeks] Re: Sum of sub array

2006-01-02 Thread Michael Ageeb
Yes but this will consume O(n) time at the start of the algorithm as a pre-calculations

[algogeeks] Re: Sum of sub array

2006-01-02 Thread Mattia Merzi
On 1/2/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > wont it take O(n^2) memory the partial sum of any "distance" would take O(n^2) memory, the partial sum from the first element to any element of the array takes O(n) memory. If you want the sum from the i-th to the j-th element, just comput

[algogeeks] Re: Sum of sub array

2006-01-02 Thread [EMAIL PROTECTED]
wont it take O(n^2) memory

[algogeeks] Re: Sum of sub array

2006-01-02 Thread phoenixinter
just read these array is O(n) then precompute the partial-sum O(n) sum from (i,j) takes O(1) time

[algogeeks] Sum of sub array

2006-01-02 Thread Abhi
Given sorted array of size n. For any i, j < n; return me sum from array[i] to array[j] in O(log n). You can use O(n) memory, do pre-computations and store it in a data structure -Abhishikt

[algogeeks] Re: Finding duplicate

2006-01-02 Thread pramod
Hi Varadha, Could you present your logic please?