The following three blocks of codes are meant to find the initial coefficients of the expansion of a binomial expression up to power 6. That is, since (x + y)^6 = x^6 + 6x^5y + 15x^4y^2 + 20x^3y^3 + 15x^2y^4 + 6xy^5 + y^6, the program is meant to obtain the numbers 1, 6, 15, 20, 15, 6, 1 given only the input 6. Each block of code represents one of three different methods of finding the numbers. The question is: What are the Time complexity (Big "O") of each block of codes given that the input is 6 in each method? Thank you as I anticipate your answers.
I combined the three methods in one program and named the codes accordingly and the above is the result of the profiling. What now is the Time complexity, is it n or n-square or log n or exp(n)?
The following three blocks of codes are meant to find the initial coefficients of the expansion of a binomial expression up to power 6. That is, since (x + y)^6 = x^6 + 6x^5y + 15x^4y^2 + 20x^3y^3 + 15x^2y^4 + 6xy^5 + y^6, the program is meant to obtain the numbers 1, 6, 15, 20, 15, 6, 1 given only the input 6. Each block of code represents one of three different methods of finding the numbers. The question is: What are the Time complexity (Big "O") of each block of codes given that the input is 6 in each method? Thank you as I anticipate your answers.
First method - THE USE OF PASCAL'S TRIANGLE
Second method - THE USE OF FACTORIAL
Third method: THE TABULAR METHOD