Answer:
See explaination for the program code
Explanation:
The code below
Pseudo-code:
//each item ai is used at most once
isSubsetSum(A[],n,t)//takes array of items of size n, and sum t
{
boolean subset[n+1][t+1];//creating a boolean mtraix
for i=1 to n+1
subset[i][1] = true; //initially setting all first column values as true
for i = 2 to t+1
subset[1][i] = false; //initialy setting all first row values as false
for i=2 to n
{
for j=2 to t
{
if(j<A[i-1])
subset[i][j] = subset[i-1][j];
if (j >= A[i-1])
subset[i][j] = subset[i-1][j] ||
subset[i - 1][j-set[i-1]];
}
}
//returns true if there is a subset with given sum t
//other wise returns false
return subset[n][t];
}
Recurrence relation:
T(n) =T(n-1)+ t//here t is runtime of inner loop, and innner loop will run n times
T(1)=1
solving recurrence:
T(n)=T(n-1)+t
T(n)=T(n-2)+t+t
T(n)=T(n-2)+2t
T(n)=T(n-3)+3t
,,
,
T(n)=T(n-n-1)+(n-1)t
T(n)=T(1)+(n-1)t
T(n)=1+(n-1)t = O(nt)
//so complexity is :O(nt)//where n is number of element, t is given sum
None of it passes through. Most of the light is either reflected by the object or absorbed and converted to heat. Materials such as wood, stone, and metals are opaque to visible light.
Good luck
Answer:
The solution code is written in C++
- float cellPhone(int m, int tx){
- float COST_PER_MIN = 0.1;
- float COST_PER_MESSAGE = 0.2;
-
- float bill_amount = m * COST_PER_MIN + tx * COST_PER_MESSAGE;
-
- return bill_amount;
- }
Explanation:
Firstly, declare a function named cellPhone() that takes two input parameters, m and tx (Line 1).
Since the policy of the carrier company is not given in the question, I make a presumption that the cost per minutes is $0.10 and the cost per message is $0.20 (Line 2- 3).
Next, apply the formula m * COST_PER_MIN + tx * COST_PER_MESSAGE to calculate the total bill (Line 5) and return the bill_amount as function output (Line 7).
Answer:
Computer engineering is a career that works on the development and research of new technology-related things.
Explanation: