I have to answer with the runtime for Big O for a few examples of C++ code. I'm generally having some trouble grasping the concept of Big O but two particular problems are stumping me:
cin >> x;
double n = example(x);
for ( i =0; i << n; i++)
{
cout << i + 100;
}
double example(int j)
{ return j * j; }
and
cin >> n;
k = 1;
do
{
j = 1;
do
{
.
.
j = 2 *j;
}while (j <= n);
k++;
}while(k <= n);
What stumps me in particular on the top one is the return statement (my other problems don't feature it), and the bottom one has a do-while loop which the other problems also don't have. How would I go about tackling these problems?