subject

Let A[1..n] be a sorted array of n numbers. Here is a code for finding the index of a number x in A. The code uses two indexes, left and right, such that w is between A[left) and A[right]. That is, A[left] < x < A[right]. We start when left = 1 and right = n.

Find(A, x, left, right) {

if (right == left) Return right
Else {mid = [ (right + left)]}
# Note: This is not actually the median value
if x == A[mid) return mid.
If x < A[mid call Find(A, x, left, mid – 1)
Else call Find(A, x, mid, right)

Assume that this code is invoked by calling Find(A, X, 1, n), but x is not one of the keys stored in the array. Write a recursive function that describes the running time in the worst case, and in the best case (the answers are slightly different). Express your answer as logan, where a is a constant you need to specify (Hint: It is not 2).

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Write a program that asks the user to enter the name of an input file. if the file does not exist, the program should prompt the user to enter the file name again. if the user types quit in any uppercase/lowercase combinations, then the program should exit without any further output.
Answers: 3
You know the right answer?
Let A[1..n] be a sorted array of n numbers. Here is a code for finding the index of a number x in A....
Questions