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
IS THERE ANYONE THAT CAN HELP ME WITH THIS? 40 POINTS AND BRAINLLEST FOR A RIGHT ANSWER PLEASE ANYONE?
Rufina [12.5K]

Answer:

33

Step-by-step explanation:

So we substitute the numbers for the variable and we get 24 + 36/4. This 24 + 9 which equals 33. So the answer is 33. I hope this helped!

8 0
3 years ago
Simplify and Combining like terms: Steps how to solve the equation. What is the steps in answering an equation like this one?
Archy [21]
A rule of thumb in these type of equations (at least, for me, personally) is to bracket off the like term. We’ve got 3 things here, so we gotta bracket them.
(5)+(10s-8s)
So now, we’ve got them separated. Next, we perform our given function. In this case, we subtract 8 from 10, leaving us with 2.
(5)+(2s)
As we no longer have any like terms, to be simplified or otherwise, we open the brackets:
5+2s
And you’ve obtained your answer!
Answer= 5+2s
3 0
3 years ago
If y varies inversely with x and y = 8 when x = 5, then what is y when x = 2?
Tomtit [17]
I would say it is 4 because that is really the only one to make much sense <span />
8 0
4 years ago
If my grandma is baked 30 cookies how many cookies does she backed
bearhunter [10]

Answer:

if she baked thirty cookies she has 30 cookies

Step-by-step explanation:

5 0
4 years ago
Read 2 more answers
Eric is adding water to a 60-gallon pool.
Liula [17]
2.5 minutes hope this helps
8 0
3 years ago
Other questions:
  • What is the probability that a person chosen at random from this group has brown or green eyes?
    13·1 answer
  • What is the mode of this set of data? 1982 1988 1989 1994 1995 2005
    11·2 answers
  • 5 1/3 divided by 7/8
    11·1 answer
  • Term insurance covers the insured for the stated term of the policy.<br><br> True<br> False
    9·2 answers
  • Find the coordinates for the midpoint of the segment with endpoints given 12,4 and -8,8
    11·2 answers
  • Explain why the amount of money in the account at the end of t years is given by the formula:
    13·1 answer
  • A bottle of syrup has a mass of 560 grams. if the empty bottle has a mass of 305 grams, what is the mass of the syrup?
    12·1 answer
  • What is -7.5 • -2 and 3/4
    14·1 answer
  • The linear function is represented by the equation y = – 2. What can be determined of this equation written in slope-intercept f
    9·1 answer
  • PLEASE HELP!!!!!!!!!!!!!!!!​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!