Consider the following code to initialize an array in C doub

Consider the following code to initialize an array in C++: double A[100][100]; ... for (int i = 0; i

Solution

1)
Both left side and right side are code similar. only iteration variables are different.
So as we have two for loops, the execution time is O(n^2) where execution speed is same for both codes.

-------------------------------------------------------------------------------------------------------------
2)

For A[10][10] = 40000
From A[10][50] ==> 40 elements are there.
Total elements upto A[40][50] = 2000
So from A[10][10] <-> A[40][50] =====> 2000 - 100 = 1900 elements are there.

So location will be 40000 + 1900 ==> 41900

-----------------------------------------------------------------------------------------------------------
3)
last = A[100][100];
This statement will retrieve the data at the location [100][100]
and it prints the value.

 Consider the following code to initialize an array in C++: double A[100][100]; ... for (int i = 0; i Solution1) Both left side and right side are code similar.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site