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

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

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!