Create a new binaryFind method in the Searcher class that works on any object of the type Comparable and takes a List of Comparable objects.

What will be an ideal response?

```
//**
* Method to use a b inary s each to f i n d a t a r g e t comparable
* o b j e c t in a l i s t of comparable o b j e c t s
* @param t a r g e t the o b j e c t you are l o o k i n g f o r
* @param l i s t the l i s t o f comparable o b j e c t s to l o o k in
* @return a s t r i n g t e l l i n g you i f i t was found
*/
public static String binaryFind (Comparable target ,
Li s t l i s t )
{
int start = 0 ;
int end = l i s t . s i z e ( ) ยก 1 ;
int checkpoint = 0 ;
while ( s t a r t <= end )
{ //While t h e r e are more to s ear ch
// f i n d the middle
che ckpoint = ( s t a r t+end ) / 2 ;
System . out . p r i n t l n ( "Checking at : "+
che ckpoint+" s t a r t="+s t a r t+" end="+end ) ;
i f ( t a r g e t . compareTo ( l i s t . ge t ( che ckpoint ) ) == 0)
{
return "Found i t ! " ;
}
el se i f ( t a r g e t . compareTo ( l i s t . ge t ( che ckpoint ) ) > 0)
{
}
return "Not found" ;
}
```

Computer Science & Information Technology

You might also like to view...

Many programs contain millions of lines of computer programming language code. With so many lines of code, _____ are inevitable.

a. viruses b. bugs c. frustrated programmers d. frustrated users

Computer Science & Information Technology

A(n) ________ trendline add/sets a linear trendline with a two-period forecast for the designated chart series

Fill in the blank(s) with correct word

Computer Science & Information Technology