Unnamed
public text v1 · immutablelist.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