For the following code snippet, provide line-by-line analysis and construct function T(n) that give the run time of this code snippet as a function of “n”. Also determine the big-O of for this code snippet.
x = 10,000;
for (int i = 1; i <= n; i++) {
if ( x < i)
sum += foo( i );``
system.out.print(sum);
else
for (j = 1; j <= i; j++)
system.out.print( i );
system.out.println( );
}
foo (a) {
for (int i = 0; i < n; i++)
sum += a * i;
return sum;
}