Question: data structure Q2. [10 pts] Write a Java program that will test an array if: [10 pts] a. Check if Sorted Write function CheckSorted(0 to
![data structure Q2. [10 pts] Write a Java program that will](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66e16c06e41b3_28666e16c0693e66.jpg)
data structure
Q2. [10 pts] Write a Java program that will test an array if: [10 pts] a. Check if Sorted Write function CheckSorted(0 to return true if the array is sorted in ascending order b. Find if there is a pair with a given sum. Write function FindSum() given an array, find if array has a pair with given sum 'x'. It may be assumed that all elements in array are distinct. Examples: Input: arr 11, 15, 6, 8, 9,10), x- 16 Output: true There is a pair (6, 10) with sum 16 Input: arr 11, 15, 26, 38, 9, 10), x 45 Output: false There is no pair with sum 45
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
