Question: package MissingNumber; import java.lang.Math; public class Oracle { long [ ] data; / / Creates a new oracle, ready to be told all numbers /
package MissingNumber;
import java.lang.Math;
public class Oracle
long data;
Creates a new oracle, ready to be told all numbers
in any order from to except for one or two.
Must run in O time.
Oracle
Tells the oracle a number between and not yet told.
Must run in O time.
void tellint i
If every number between and except one have
been told, and no number has been told more than once,
sets MissInt equal to the one number not yet told.
Otherwise has undefined behavior.
Must run in O time.
void missingoneint MissInt
If every number between and except two have
been told, and no number has been told more than once,
sets MissInt and MissInt equal to the two numbers
not yet told where MissInt MissInt
Otherwise has undefined behavior.
Must run in O time.
void missingtwoint MissInt
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
