Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA PROGRAMMING: Write a program that finds the maximum increasingly ordered su

ID: 642244 • Letter: J

Question

JAVA PROGRAMMING:

Write a program that finds the maximum increasingly ordered subsequence of characters in a string. Analyze the time complexity of your program.

Write a program that obtains the execution time for finding the GCD of every two consecutive Fibonacci numbers from the index 40 to index 45 using the algorithms in Listings 22.3 and 22.4 in the text. Display the results in a table.

Write a method that uses the divide-and-conquer approach to find the smallest number in an array. Test your method with multiple arrays.

Explanation / Answer

1)

3)

Examples:

Method 1 (Linear Search)
Linearly search for x, count the occurrences of x and return the count.

Time Complexity: O(n)

Method 2 (Use Binary Search)
1) Use Binary search to get index of the first occurrence of x in arr[]. Let the index of the first occurrence be i.
2) Use Binary search to get index of the last occurrence of x in arr[]. Let the index of the last occurrence be j.
3) Return (j