Re: [algogeeks] Needed recursive sol

2011-10-01 Thread Shuaib Khan
I am I not wrong, the problem asks for fib numbers which are even, not fib numbers with even index...? On Sat, Oct 1, 2011 at 10:16 PM, Wladimir Tavares wladimir...@gmail.comwrote: F(0)+F(2)+...+F(2n) = F(2n+1) - 1 Wladimir Araujo Tavares *Federal University of CearĂ¡

[algogeeks] Maximum possible edges in a graph

2011-09-06 Thread Shuaib Khan
What is the maximum number of edges possible in a graph with N nodes, and where any three nodes can have at most two edges between them. 1=N=10. -- Shuaib -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

[algogeeks] Re: Maximum possible edges in a graph

2011-09-06 Thread Shuaib Khan
I don't have a formal proof yet, but can anyone give a counter test case to following: Let f(n) be our function: if n is even: f(n) = (n^2)/4 else: f(n) = ((n-1)^2)/4 + (n-1)/2 On Wed, Sep 7, 2011 at 5:36 AM, Shuaib Khan aries.shu...@gmail.com wrote: What is the maximum number of edges

Re: [algogeeks] math puzzle

2011-08-28 Thread Shuaib Khan
You don't need trial and error. Start by setting x = 1, 2, 3... and find values for y. If the y you get is a positive integer, you have a solution. On Sun, Aug 28, 2011 at 5:46 PM, sivaviknesh s sivavikne...@gmail.comwrote: *Find the number of solutions for 3x+4y=60, if x and y are positive

Re: [algogeeks] Re: find numbers whose difference is min

2011-08-16 Thread Shuaib Khan
Dave, I agree. :) On Tue, Aug 16, 2011 at 6:33 PM, Dave dave_and_da...@juno.com wrote: @Shuaib: We are talking about an array of numbers, arent't we? It is natural to assume that the numbers fall into one of the defined data types. Dave On Aug 16, 4:23 am, Shuaib aries.shu...@gmail.com

Re: [algogeeks] Probability question.. help

2011-08-09 Thread Shuaib Khan
On Wed, Aug 10, 2011 at 1:45 AM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: No thers is not.. someone has asked me this., dont know anything else about the question :| Seems like you got half of the question there. -- You received this message because you are subscribed to

Re: [algogeeks] Re: Probability Puzzle

2011-08-08 Thread Shuaib Khan
Man, I feel so stupid. Yes, it is a case of conditional probability. We have to calculate the probability of six heads, given that 5 heads have occured. So answer is 17/18. On Tue, Aug 9, 2011 at 1:47 AM, Arun Vishwanathan aaron.nar...@gmail.comwrote: @shady: 3/5 can be the answer to such a

Re: [algogeeks] Re: A Nice Programming Challenge Question

2011-08-07 Thread Shuaib Khan
On Sun, Aug 7, 2011 at 11:06 PM, Dave dave_and_da...@juno.com wrote: @Yasir: Sort the numbers. Then int i = 0, j = 1, m, p = 0; while( j N ) { m = a[j] - a[i]; if( m = K ) ++p; else if( m K ) ++j; else ++i; } // answer = p Looks like an infinite

Re: [algogeeks] Re: Probability Puzzle

2011-08-07 Thread Shuaib Khan
On Mon, Aug 8, 2011 at 12:40 AM, Puneet Gautam puneet.nsi...@gmail.comwrote: Sixth toss is independent of previous tosses and dependent only on coin selection...! 1/5 + 4/5(1/2)= 3/5 is the correct answer we want to calc. probability of getting heads the sixth time only even if

Re: [algogeeks] Re: Probability Puzzle

2011-08-07 Thread Shuaib Khan
is the probability that heads will show up the first five times, plus a sixth time. Not just the sixth time. The first five times head showing up is part of the question. On Mon, Aug 8, 2011 at 1:12 AM, Shuaib Khan aries.shu...@gmail.comwrote: On Mon, Aug 8, 2011 at 12:40 AM, Puneet Gautam

Re: [algogeeks] Re: Probability Puzzle

2011-08-07 Thread Shuaib Khan
On Mon, Aug 8, 2011 at 12:51 AM, aseem garg ase.as...@gmail.com wrote: @Shuaib: **What is the probability that you toss *next time, heads turns up***. Well if you interpret it your way, then you are right. Otherwise, not. Aseem On Mon, Aug 8, 2011 at 1:19 AM, Shuaib Khan aries.shu

Re: [algogeeks] A Nice Programming Challenge Question

2011-08-07 Thread Shuaib Khan
How about iterating over all the values and hashing them to a dict/map. And then iterate once more, checking that for each element 'e', |K-e| exists in the map or not. O(N)? On Sun, Aug 7, 2011 at 10:53 PM, Yasir yasir@gmail.com wrote: Guys, Let's try to find out an efficient solution for

Re: [algogeeks] A Nice Programming Challenge Question

2011-08-07 Thread Shuaib Khan
On Mon, Aug 8, 2011 at 1:07 AM, Yasir Imteyaz yasir@gmail.com wrote: @Shuaib, You are right, this approach will work! :) But for each element 'e' instead of checking whether *|K-e| *exists, *you should check for either (e+K) or (e-K).* You are right. Mistake. ;) But here the