I'm new here so cut my some slack and let me know if my question can have any improvements.
So me and a friend are at a bit of a disagreement on an algorithm's complexity. He seems to be certain that the algorithm has a big O notation of O(n^2) but I just think its O(n)
Can we have some pointers, to hopefully end our argument ha!
The Algorithm:
Input: Matrix M[1..n][1..n]
Output: boolean true if M is lower triangular
begin isLowerTriangular(Matrix[][] M, size n)
for i:=1 to n-1 loop
for j:=i+1 to n loop
if M[i][j] != 0
return false
return true
end isLowerTriangular
n*(n-1)/2n. So ifi+1=2andn=100it will iterate98times