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] = count } return count == val) count + 1 1b. Write the algorithm which sorts the array by using the merge sort algorithm. Then find the complexity of the algorithm as O notation. 1c. Write the algorithm which sorts the array by using the quick sort algorithm. Then find the complexity of the algorithm as Big O notation.

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
1b. Write the algorithm which sorts the array by using the merge sort algorithm. Then find the complexity of the
algorithm as Big O notation.
1c. Write the algorithm which sorts the array by using the quick sort algorithm. Then find the complexity of the
algorithm as Big O notation.
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 1b. Write the algorithm which sorts the array by using the merge sort algorithm. Then find the complexity of the algorithm as Big O notation. 1c. Write the algorithm which sorts the array by using the quick sort algorithm. Then find the complexity of the algorithm as Big O notation.
Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer