Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. 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] = 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started