Question: High level Pseudocode please. Problem MUST use the f() function. 1. You are a hacker, trying to gain information on a secret array of size

 High level Pseudocode please. Problem MUST use the f() function. 1.

High level Pseudocode please.

Problem MUST use the f() function.

1. You are a hacker, trying to gain information on a secret array of size n. This array contains n-1 ones and exactly 1 two; you want to determine the index of the two in the array. Unfortunately, you don't have access to the array directly; instead, you have access to a function f(11,12) that compares the sum of the elements of the secret array whose indices are in ll to those in 12. This function returns 1 if the l1 sum is smaller, 0 if they are equal, and 1 if the sum corresponding to 12 is smaller. For example, if the array is a = [1,1,1,2,1,1) and you call f([1, 3, 5], [2,4,6]) then the re- turn value is 1 because a[1] + a[3] + a[5] = 3

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!