Question: 1. Modify the recursive binary search algorithm so that it returns the index of the target in the sequence or -1 (if the target is

1. Modify the recursive binary search algorithm so that it returns the1. Modify the recursive binary search algorithm so that it returns the index of the target in the sequence or -1 (if the target is not found). (5 points)

2. Write a recursive algorithm for computing the nth Harmonic number, defined as = 1 =1 . (10 points)

3. Write a short recursive algorithm that determines if a string s is a palindrome, that is, it is equal to its reverse. For example, racecar, gohangasalamiimalasagnahog. (10 points)

4. What values are returned during the following sequence of queue operations, if executed on an initially empty queue? enqueue(5), enqueue(3), dequeue(), enqueue(2), enqueue(8), dequeue(), dequeue(), enqueue(9), enqueue(1), dequeue(), enqueue(7), enqueue(6), dequeue(), dequeue(), enqueue(4), dequeue(), dequeue(). (5 points)

Please write Java codes to solve the following questions. The submissions should be your answers, source codes and screen-shots of the program results. 1. Modify the recursive binary search algorithm so that it returns the index of the target in the sequence or -1 (if the target is not found). (5 points) 2. Write a recursive algorithm for computing the n'h Harmonic number, defined as Hn = EX=1 (10 points) 3. Write a short recursive algorithm that determines if a string s is a palindrome, that is, it is equal to its reverse. For example, "racecar', gohangasalamiimalasagnahog: (10 points) 4. What values are returned during the following sequence of queue operations, if executed on an initially empty queue? enqueue(5), enqueue(3), dequeue(), enqueue(2), enqueue(8), dequeue(), dequeue(), enqueue(9), enqueue(1), dequeue(), enqueue(7), enqueue(6), dequeue(), dequeue(), enqueue(4), dequeue(), dequeue. (5 points)

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!