Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

is not very useful. However, you can use Write the algorithm (pseudo-code) the i

ID: 649637 • Letter: I

Question

is not very useful. However, you can use

Write the algorithm (pseudo-code) the implements the above recursive definition. And What is the approximate time complexity of this algorithm? Are any cases particularly bad?

Your task is to produce an algorithm for Write the algorithm (pseudo-code) the implements the above recursive definition. And What is the approximate time complexity of this algorithm? Are any cases particularly bad? is not very useful. However, you can use that does not require multiplication, which means that the formula

Explanation / Answer

#include<stdio.h>
void cmbnt(int n, int c, int ind, int combs[])
{
    if(c == 0)
    {
        int i;
        for(i = 0; i < ind; i++)
            printf("%d ", combs[i]);
        printf(" ");
        return;
    }
    if(n == 0)
        return;
      
    combs[ind] = n;
    cmbnt(n-1, c-1, ind+1, combs);
    cmbnt(n-1, c, ind, combs);
}

int main()
{
    int arr[2];
    cmbnt(3, 2, 0, arr);
}