Question: Write C++ code, algorithm and plot graphs Design a recursive algorithm to perform ternary search Ternary-Search(A, key,lb,ub) on a list of numbers A in non-decreasing

 Write C++ code, algorithm and plot graphs Design a recursive algorithm

Write C++ code, algorithm and plot graphs

Design a recursive algorithm to perform ternary search Ternary-Search(A, key,lb,ub) on a list of numbers A in non-decreasing order. Consider the same conditions as considered for binary search. Construct the recurrence relation for the algorithm. Solve it to find the time complexity. Compare time-space required by recursive and iterative versions of ternary search. Find the speed up achieved by ternary search over binary search. Compare the space required by binary and ternary search. Plot graphs to compare time and space by varying input size as n = 10, 100, 1000, 10000, 100000, 1000000. a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!