Put them in code tags. Anyway, I am NOT going to help you with the binarySearch method (as in, I will not write it) because the algorithm is very important and there's no reason why, after a little reading, you can't implement it yourself. It'll be in your text, and if for some strange reason it's not,
http://www.google.com; It's very important and you need to know how to implement it.
This is what I would do...
Code:
class List
{
private boolean isSorted = false;
// rest of variables.
public List (int s)
{
// rest of construction
// but need to add:
this.size = s;
}
public int getMax()
{
if( !isSorted)
sortList();
return intArray[size-1];
}
public int getMin()
{
if(!isSorted)
sortList();
return intArray[0];
}
public void sortList()
{
// Everything else
this.isSorted = true;
}
public void binarySearch(int sn)
{
if(!isSorted)
sortList();
// Rest of implementation.
}
// Everything else
}
-- X Conrad X