Question: Algorithms question! Let A [1.. n ] be a sorted array of n integers, and x a positive integer. Note: Plz do not copy paste
Algorithms question!
Let A[1..n] be a sorted array of n integers, and x a positive integer.
![Algorithms question! Let A[1..n] be a sorted array of n integers, and](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f51e88a2848_16866f51e881466e.jpg)
Note: Plz do not copy paste incorrect solutions from other chegg experts related to this question as those are incorrect. I just need a form of pseudo code for part a (not a detailed code in any programming language). Plz provide correct solution for upvote!
a) Design a O(n) recursive algorithm that returns i and j if there are two elements A[i] and A[j] such that i=j, whose sum is exactly x, otherwise it returns none. b) Find a recurrence relation that describes the number of element comparisons carried out by the recursive algorithm. c) Solve the recurrence relation and express the solution asymptotically
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
