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

Write Three JAVA PROGRAMS: First Program : Write a program that finds the maximu

ID: 642417 • Letter: W

Question

Write Three JAVA PROGRAMS:

First Program :

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

Second 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.

Third Program:

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote