Assume that n is a positive integer.
for i: = 1 to 2n
s := 0
for j := 1 to i − 1
s := s + j · (i − j + 1)
next j
r := s2
next i
(a)
Compute the actual number of elementary operations (additions, subtractions, multiplications, divisions, and comparisons) that are performed when the algorithm segment is executed. For simplicity, however, count only comparisons that occur within if-then statements; ignore those implied by for-next loops.
________ operations

Respuesta :

The next i operation doesn't take into account comparisons implied by for-next loops, only those that take place within if-then expressions.

How many simple operations are there in reality?

A matrix can be transformed or operated on in three simple ways: swapping of any two rows or columns. a non-zero number is multiplied by a row or column. Row or column multiplication by a non-zero value, then adding the result to the other row or column.

What do programmers refer to as "elementary operations"?

For a specific machine and programming language, a basic operation is one whose execution time is constrained by a constant. In a multiplicative constant, the number of elementary operations performed rather than the precise time is what is important for the analysis.

To know more about  for-next loops visit :-

https://brainly.com/question/11857356

#SPJ4

Otras preguntas

ACCESS MORE
EDU ACCESS
Universidad de Mexico