Wrap your head around this.
-
Wrap your head around this.
Wrap your head around this. What? What am I wrapping my head around?
-
Wrap your head around this. What? What am I wrapping my head around?
Can't help out there, unless you turn on your webcam. :doh:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
Can't help out there, unless you turn on your webcam. :doh:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Luc Pattyn wrote:
unless you turn on your webcam
Oh it's on alright ;P
-
Wrap your head around this. What? What am I wrapping my head around?
-
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
}Neat looks like the number of k-combinations from a set of n elements http://en.wikipedia.org/wiki/Combination
-
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
} -
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
} -
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
}pascal triangle it is
-
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
}I afraid if k is greater than n first call to C in second return [C(n - 1, k)] will end up with exception as it will go in infinite loop.. :^) BTW this method will always return value greater than 1 if not an exception. CASE CLOSED .. Its Nothing ;P
modified on Wednesday, March 31, 2010 8:11 AM
-
Can you figure out what it does? You won't have much luck trying to step through it or running it with numbers larger than two.
int C(int n, int k)
{
if(k == 0 || k == n)
return 1;
else
return C(n - 1, k) + C(n - 1, k - 1);
}Appears to be a Fibonacci sequence.