1. Engineering
  2. Computer Science
  3. q1 what is the bigoh o time complexity for the...

Question: q1 what is the bigoh o time complexity for the...

Question details

Q1. What is the big-Oh (O) time complexity for the following algorithm (shown in pseudocode) in terms of input size n? Show all necessary steps: (a) Algorithm MyAlgorithm (A,B) Input: Arrays A and B each storing n >- 1 integers Output: What is the output? (Refer to part b below) Start: count0 С 3 for i0 to C do sum O for j 0 to n-l do sumsum + A[0] for k - 1 to j do sumsum A [k] if B[il -sum then count - count 1 return count (b) Document a hand-run on MyAlgorithm for input arrays A [9 2 5 1] and B [40 29 257] and show the final output.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution