All pastes #467520 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-02 15:54 UTC
rendered paste body
list.removePerson(personName, 1, list.size(), list);

public int removePerson(String person, int first, int last, ListInterface list) {
	  int index = 0;
	  
	  if (first > last) { System.out.println("Person not found"); return -1; }
	  else { 
		  int mid = (first + last)/2;
		  int check = ((Person)get(mid)).getName().compareTo(person);
		  if(check > 0)
			  return removePerson(person,mid+1,last,list);
		  if(check < 0)
			  return removePerson(person,first,mid-1,list);
		  else
			  return mid;
	  }
  } // end removePerson