Question: 15) Consider the decision version of the Binary Search algorithm, which takes an array a of integers of size n, an integer x to be

 15) Consider the decision version of the Binary Search algorithm, which

15) Consider the decision version of the Binary Search algorithm, which takes an array a of integers of size n, an integer x to be found, and gives a boolean result. Which of the following statements corresponds to a pair of valid Pre- and Post-conditions? Note: Assume issorted() implies ascending numeric order: A) PRE:n > 1 POST: result == x E a A is Sorted (a) B) PRE: True POST:isSorted(a) An > 1 C) PRE:n > 1A is Sorted (a). 10 sxs a[n-1] POST: result == x E a vissorted(a) D) PRE:n 1 An == size (a) A is Sorted (a) A a [0] SX Sa(n-1) POST: result == XE a E) PRE:n > i^n -- size (a) ^ a[0] 5 x 5 a (n-1] POST: result = X Ea

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!