Question: 2. (10 pts) Recall the O(n lg n)-time algorithm given in class that on an input array A of integers and a given integer intVal,

2. (10 pts) Recall the O(n lg n)-time algorithm given in class that on an input array A of integers and a given integer intVal, finds two indices i and j, where A[i] + A[j] = intval. Show how the algorithm can be modified in order to find indices i and j, where All - All = intVal instead. Analyze the running time of the modified algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
