Given the pseudocode below answer the following questions Al
Given the pseudocode below, answer the following questions: Algorithm What (A, n) A leftarrow 2-dimensional array of n times n integers B leftarrow 1-dimensional array of n integers for leftarrow n-5 to n-3 do for j leftarrow 0 to n-1 do B[i] leftarrow B[i] + A[i][j] end for end for What is the Big-O order of the memory required by the algorithm? How many times is the innermost loop executed, as a function of n? What is the Big-0 order of the operations required by the algorithm?
Solution
a. Big-O order of memory required = O(n^2) for A and O(n) for B. So result would be O(n^2).
Big-O order of memory required means how much memory is expected to grow as a function of n. Here, as n increases memory required for A would increase by n^2
b. It is exectued O(2*n) -> O(n).
