I suspect an error in
𝑝𝑟𝑜𝑐𝑒𝑑𝑢𝑟𝑒 𝑀𝑎𝑡𝐸𝑙𝑒𝑚𝑒𝑛𝑡𝑠𝑆𝑢𝑚(𝐴[0 β¦ 𝑛 β 1,0, β¦ . 𝑚 β 1])
𝑠𝑢𝑚 = 0;
𝑓𝑜𝑟 𝑖 = 0 𝑡𝑜 𝑛 β 1 𝑑𝑜
𝑓𝑜𝑟 𝑗 = 0 𝑡𝑜 𝑚 β 1 𝑑𝑜
𝑠𝑢𝑚 = 𝑠𝑢𝑚 + 𝐴[𝑖]
𝑒𝑛𝑑 𝑓𝑜𝑟
𝑒𝑛𝑑 𝑓𝑜𝑟
𝑟𝑒𝑡𝑢𝑟𝑛 𝑠𝑢𝑚
𝑒𝑛𝑑 𝑝𝑟𝑜𝑐𝑒𝑑𝑢𝑟𝑒
, but it does not change the result of complexity.
Quote:
Algorithm 1: Algorithm to find the sum of all elements of a matrix of size π β π
Without looking at code, how many operations do you need to do to sum all elements of a matrix n*m ?
If matrix is 2*2, 3*3, 5*6, 10*10 ?
Now look at the code and try to get how many times each line is executed.
Quote:
I have been given a task so I am not able to track the solution therefore, I approach this forum.
It is impossible to come up with nothing, unless you skipped the course.
If you are just not sure of your solutions, show it and tell us.
[Update]
Quote:
I have enthusiasm to solve paper posted on pdfcoffee.com
No, you are enthusiast to have us solving the problem and then post our solution as being your work.
You'd better learn how to solve the problem by yourself.