TCS
Company
Programming
Output
Find the minimum number of arithmetic operations required to evaluate below expression
f(P) = 8P^3 + 3P +12
Note - for a given value of P using only one temporary variable.
Read Solution (Total 9)
-
- 8P^3+3P+12
=P(8(P^2)+3)+12
Temporary variable is only one according to ques.
lets, take T as temporary variable.
T=p*p
T=8T
T=T+3
T=p*T
T=T+12
Therefore 5 arithmetic operations are required.
ANS : 5 - 3 years agoHelpfull: Yes(6) No(0)
- P = 1 given
so,
f(P) = 8P^3 + 3P + 12
f(1) = 8*1^3 + 3*1 + 12
f(1) = 23 - 3 years agoHelpfull: Yes(2) No(3)
- I got the solution
here is the link
https://brainly.in/question/27102880 - 2 years agoHelpfull: Yes(1) No(1)
- I don't know
- 3 years agoHelpfull: Yes(0) No(5)
- Even i also don't know
- 2 years agoHelpfull: Yes(0) No(0)
- total 5
T=8*p
Y=T^3
U=Y+3
I=U*P
O=I+12 - 2 years agoHelpfull: Yes(0) No(0)
- p[(8p^2)+3]+12
p[(8p(p)+3]+12
so,total = 5 - 2 years agoHelpfull: Yes(0) No(0)
- F(p)=8P^3+3P+12
=p(8p^2+3)+12
=p(8(p)(p)+3)+12
No of brackes=3 + no of '+'=2
3+2=5
5 is the answer - 1 year agoHelpfull: Yes(0) No(0)
- Take P as common from first two terms
P(8P^2 + 3) + 12
P×(8×P×P + 3) + 12
Total: 5 (3 multiplications and 2 additions have to be performed )
Min =5 operations and max =6 operations if the expression is kept as it is without taking P as common element. - 3 Months agoHelpfull: Yes(0) No(0)
TCS Other Question