1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lelechka [254]
3 years ago
15

A. Consider the following algorithm segment: for i := 1 to 4, for j := 1 to i, [Statements in body of inner loop. None contain b

ranching statements that lead outside the loop.] next j, next i. How many times will the inner loop be iterated when the algorithm is implemented and run?
b. Let n be a positive integer, and consider the following algorithm segment: for i := 1 to n, for j := 1 to i, [Statements in body of inner loop. None contain branching statements that lead outside the loop.], next j, next i. How many times will the inner loop be iterated when the algorithm is implemented and run?
Mathematics
1 answer:
yuradex [85]3 years ago
6 0

Answer:

(a) 4i times

(b) "i × n" times

Step-by-step explanation:

(a) Given the algorithm segment;

       for i := 1 to 4,  (Outer loop)

            for j := 1 to i   (Inner loop)

            next j,

       next i

The inner loop runs for i times, while the outer loop runs for 4 times.

The total times the inner loop would run when the entire algorithm is run is:

      = i × 4

      = 4i times

(b) Given the algorithm segment;

     for i := 1 to n,  (Outer loop)

            for j := 1 to i   (Inner loop)

            next j,

      next i

Where n is a set of positive integers.

The inner loop runs for "i" times, while the outer loop runs for "n" times.

The total times the inner loop would run when the entire algorithm is run is:

      = i × n

      = "i × n" times

You might be interested in
Two rectangles are similar. If the height of the first rectangle is 3 inches, and the height of the second rectangle is 9 inches
scoundrel [369]
Three times longer than the second one.
6 0
3 years ago
A table titled hours spent studying has entries 4, 5, 9, 15, 8, 2, 20, 1, 6, 9, 10, 8, 10, 8, 1, 2.
Elena L [17]

Answer:

Range = from the starting number(smallest #) to the largest number

Step-by-step explanation:

1-20

5 0
3 years ago
Read 2 more answers
How to find the average squared distance between the points of the unit disk and the point (1,1)
ddd [48]
The unit disk can be parameterized by the function

\mathbf p(r,\theta)=(r\cos\theta,r\sin\theta)

where 0\le r\le 1 and 0\le\theta\le2\pi. The squared distance between any point in this region (x,y)=(r\cos\theta,r\sin\theta) and the point (1, 1) is

(x-1)^2+(y-1)^2=(r\cos\theta-1)^2+(r\sin\theta-1)^2
=(r^2\cos^2\theta-2r\cos\theta+1)+(r^2\sin^2\theta-2r\sin\theta+1)
=r^2(\cos^2\theta+\sin^2\theta)-2r(\cos\theta-\sin\theta)+2
=r^2-2r(\cos\theta-\sin\theta)+2

The average squared distance is then going to be the ratio of [the sum of all squared distances between every point in the disk and the point (1, 1)] to [the area of the disk], i.e.

\dfrac{\displaystyle\iint_{x^2+y^2
=\dfrac{\displaystyle\int_{\theta=0}^{\theta=2\pi}\int_{r=0}^{r=1}[r^2-2r(\cos\theta-\sin\theta)+2]r\,\mathrm dr\,\mathrm d\theta}{\displaystyle\int_{\theta=0}^{\theta=2\pi}\int_{r=0}^{r=1}r\,\mathrm dr\,\mathrm d\theta}
=\dfrac{\frac{5\pi}2}\pi=\dfrac52
5 0
3 years ago
How do you find the surface area of a cube
k0ka [10]

The formula is : A=6a^2

So lets say its a cube with edge lengths of 4

We first find out the area of each side by multiplying 4*4

They you multiple the answer of that, 16, by 6, for each of the sides.

A = 96 Units ^2

6 0
3 years ago
Find the measurement of angel ABE
Lostsunrise [7]
Answer is 129(A) hope this helps:)
5 0
3 years ago
Other questions:
  • Wich pair of equations below represents perpendicular lines? <br><br> Please!!!
    7·2 answers
  • What is the greatest common factor of the polynomial below? 8x^4x​
    5·1 answer
  • The length of a rectangle is 7 more than the width. The area is 744 sqaure yards, find the length and width of the rectangle
    10·1 answer
  • A parabola can be drawn given a focus of (6,0) and a directrix of y = -6. Write the
    14·2 answers
  • If 7x+5=-2, find the value of 8x?
    9·1 answer
  • A hotel charges a $10,000 annual fee plus an additional $200 for each night you stay there. What is the average cost per night i
    14·1 answer
  • Someone plz answer these <br> https://brainly.com/question/18427880
    14·2 answers
  • Round 18 the the nearist 10.
    10·2 answers
  • PLEASE HELP,!! HURRY!!!!! 40 points!!!
    6·1 answer
  • 24+89<br> A.113<br> B.34<br> C.87<br> D.90
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!