edited by
8,482 views
25 votes
25 votes

The following function computes the value of  $\binom{m}{n}$ correctly for all legal values $m$ and $n$ ($m ≥1, n ≥ 0$ and $m > n$)

int func(int m, int n)
{
    if (E) return 1;
    else return(func(m -1, n) + func(m - 1, n - 1));
}


In the above function, which of the following is the correct expression for E?

  1. $(n = = 0) || (m = = 1)$
  2. $(n = = 0)$ && $(m = = 1)$
  3. $(n = = 0) || (m = = n)$
  4. $(n = = 0)$ && $(m = = n)$
edited by

3 Answers

Best answer
34 votes
34 votes

Answer: C

Because $\binom{m}{0}$ = $1$ and $\binom{n}{n}$ = $1$.

edited by
1 votes
1 votes
$\binom{m}{0} or   (m==n) \binom{m}{n}$

return 1;

(n==0) || (m==n)

Amswer : C
0 votes
0 votes
If we put m=1, then we can put only one value of n i.e. 0 and putting n=0, we will get the answer as 1. Then why option (a) is not correct?
Answer:

Related questions

13.5k
views
2 answers
33 votes
Ishrat Jahan asked Oct 31, 2014
13,535 views
The characters $a$ to $h$ have the set of frequencies based on the first $8$ Fibonacci numbers as follows$a : 1$, $b : 1$ ... is the sequence of characters corresponding to the following code?$110111100111010$fdheg$ecgdf$dchfg$fehdg$
11.6k
views
8 answers
30 votes
Ishrat Jahan asked Oct 31, 2014
11,616 views
Consider the depth-first-search of an undirected graph with $3$ vertices $P$, $Q$, and $R$. Let discovery time $d(u)$ represent the time instant when ... $R$ are connectedThere are two connected components, and $P$ and $Q$ are connected
12.2k
views
7 answers
37 votes
Ishrat Jahan asked Oct 31, 2014
12,199 views
Which of the following is the correct decomposition of the directed graph given below into its strongly connected components? ... $\left \{ P, Q, R, S, T, U, V \right \}$
11.8k
views
3 answers
45 votes
Rucha Shelke asked Sep 26, 2014
11,805 views
Consider the following C-function in which $a[n]$ and $b[m]$ are two sorted integer arrays and $c[n+m]$ be another integer array,void xyz(int a[], int b [], int c [ ... only (i) only (ii) either (i) or (ii) but not both neither (i) nor (ii)