Reference no: EM13165510
Write one Java Programming that calculates the binomial coefficients (nCk) using the recursive formula
(nCk)=((n-1)Ck)+((n-1)C(k-1)) with boundary values (nC0)=1 and (nCn)=1. Note that (nCk) is defined for any n>=k>=0.
Some Requirements
1. Part (a), which is not required: Use a loop to compute nCk
2.. In Part (b), you should use pure recursive calls completely and count the number of calls the program makes. You should count how many times recursive calls were made.
3. Part (c) is considered to be an improved version of Part (b). You may use an array (2-dimessional) to store some values that has been computed during the run so that when making recursive calls the program does not compute certain values over and over again.
4. Prompt user to enter two integers as n and k. Report the values of nCk together with the number of recursive calls in each way. Here is a sample output:
Enter two integers as n and k to compute C(n,k): 10 5
(b) use complete recursion: C(10,5)=252.
The number of calls is 502.
(c) use array to store some values: C(10,5)=252.
The number of calls is 50.
State what kind of compound is dihydroxypentane
: What kind of compound is 2,3-dihydroxypentane? From what precursor do you synthesize the kind of compound that 2,3-dihydroxypentane is?
|
The main program should create an ifstream
: For decryption, the main program should create an ifstream for the file to be decrypted. It should use the getline method of the ifstream to read lines from the file, call the encryption / decryption function with the line to be decrypted, and dis..
|
People must be in a group in order to guarantee
: How many people must be in a group in order to guarantee that two people in the group have the same birthday (don't forget leap year)?
|
This function should accept a two-dimensional
: getLowestInRow. This function should accept a two-dimensional array as its argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the lowest value in the specif..
|
Considered to be an improved version
: Part (c) is considered to be an improved version of Part (b). You may use an array (2-dimessional) to store some values that has been computed during the run so that when making recursive calls the program does not compute certain values over and ..
|
What mass of this substance must evaporate
: What mass of this substance must evaporate in order to freeze 112 of water initially at 18? (The heat of fusion of water is 334 the specific heat of water is 4.18 .
|
Flaw in your design and outline
: After completing Part a, discuss the flaw in your design and outline some code that will cause it to break (your code should compile fine and will also execute without an error but will violate how a rectangle or square should behave).
|
Calculate the mole percent composition of the mixture
: Calculate the weight percent composition of the mixture, using the same assumptions as in part A.
|
Modify the book class to accommodate multiple authors
: modify the Book class to accommodate multiple authors using one of the components from the Java Collection Framework.
|