Question: For the following algorithms, state the recurrence relation and use it to get the time complexity of the algorithm in Big-O notation. Algorithm int ternary

For the following algorithms, state the recurrence relation and use it to get the time complexity of the algorithm in Big-O notation. Algorithm int ternary search(int list: ai, a2, ..., an, int key, int left, int right) If left > right return 0 third,-Iteft+right t+right if key = a[third,] return thirdi else if key = althirdal return third2 else if key a[third2 right := third,-1 left := thirds + 1 else left := third-+ 1 right := third-1 return ternary_search(ai, a2, ..., an, key, left, right); This is usually initially called as on left = 1, right = n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
