Algorithm for printing @ symbols
Consider this algorithm for printing @ symbols in a particular pattern.
While n is less than or equal to 10:
print n @ symbols
go to next line
n = n + 1
a.
i.Show what is displayed as a result of this algorithm when n has an initial value of 4.
ii.How many @ symbols are printed in total when n has an initial value of 4?
b.Write down an expression that gives the total number of @ symbols that are printed by this algorithm for any value of n. Hint: consider the number of @ symbols if n = 1, and then subtract the number of @ symbols that are missing if n > 1
c.If printing an @ symbol is considered to be a step, write down the Big O notation for this algorithm. Explain your answer.
Answer
Answers can be viewed only if
 The questioner was satisfied and accepted the answer, or
 The answer was disputed, but the judge evaluated it as 100% correct.
The answer is accepted.
Join Matchmaticians Affiliate Marketing
Program to earn up to 50% commission on every question your affiliated users ask or answer.
 answered
 183 views
 $5.89
Related Questions

The given equation is x²  2mx + 2m  1=0
Determine m.  Find $x$ so that $\begin{pmatrix} 1 & 0 & c \\ 0 & a & b \\ \frac{1}{a} & x & x^2 \end{pmatrix}$ is invertible
 How to adjust for an additional variable.
 Does $\lim_{n \rightarrow \infty} \frac{2^{n^2}}{n!}$ exist?
 Does $\lim_{(x,y)\rightarrow (0,0)}\frac{(x^2y^2) \cos (x+y)}{x^2+y^2}$ exists?
 Fields and Galois theory
 Prove that $1+\frac{1}{\sqrt{2}}+\dots+\frac{1}{\sqrt{n}} \leq 2 \sqrt{n}1$
 Variance of Autoregressive models, AR(1)
I think c. is ambiguous. I would say it's O(1), since the number of @ symbols you can print is bounded, but I can see the argument for O(n^2).
Awesome, really appreciate your help Alessandro, hope you have a great new year!