Ask Question
2 January, 16:23

Suppose an array has n elements. we visit element #1 one time, element #2 two times, element #3 three times, and so forth. how many total visits will there be?

+2
Answers (1)
  1. 2 January, 16:29
    0
    The number of visits is an arithmetic sequence.

    There are ' n ' terms. They're just the counting numbers from 1 to 'n'.

    The first term is 1, the second term is 2, ..., the last term is 'n'.

    The formula for finding the sum of an arithmetic sequence is

    Sum = n (first term + last term) / 2.

    This formula is indicating that the sum of the arithmetic sequence

    is just equal to the average of the first and last term, multiplied by

    the number of terms.

    So the number of visits is

    n (1 + n) / 2.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Suppose an array has n elements. we visit element #1 one time, element #2 two times, element #3 three times, and so forth. how many total ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers