la. Find the complexity of the algorithm as Big O notation: countValue(a, n, val) { } count = 0 for i = 1 to n { if (a[i]==val) count= count + 1 } return count

icon
Related questions
Question
1a. Find the complexity of the algorithm as Big O notation:
countValue(a, n, val)
{
count = 0
for i=1 to n {
if (a[i] == val)
count count + 1
}
return count
Transcribed Image Text:1a. Find the complexity of the algorithm as Big O notation: countValue(a, n, val) { count = 0 for i=1 to n { if (a[i] == val) count count + 1 } return count
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer