Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fill in the missing piece of code 9 class OrdArray WithCollections 10 // cef to arraya 12 /private long[] a; 13 14 15 private List
Fill in the missing piece of code 9 class OrdArray WithCollections 10 // cef to arraya 12 /private long[] a; 13 14 15 private List a; private int nElems; // number of data items public OrdArray_WithCollections (int max) // constructon 17 new ArrayList(); // create array 19 20 21 a = 23 public int size() 24 25 26 11 311 27 public int find (Long searchKey) 28 29 30 31 32 return nElems; int lowerBound = 0; int upperBound- nElems-1; int curIn; while(true) 34 35 36 37 38 39 40 41 42 43 curIn // if(a[curIn]--searchKey) if(a.get (curIn).equals(searchKey return curIn; /I found it else if(lowerBoundupperBound) // can't find it // divide range return nElems; else 45 46 47 48 49 50 51 52 53 54 //if (a[curIn]
Step 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