Refer to method insert below:
/** @param list an ArrayList of String objects
* @param element a String object
* Precondition: list contains String values sorted
* in decreasing order.
* Postcondition: element inserted in its correct position in list.
*/
public void insert(List<string> list, String element)
{
int index = 0;
while (element.CompareTo(list[index]) < 0)
index++;
list.Insert(index, element);
}
Assuming that the type of element is compatible with the objects in the list, which is a true statement about the insert method?
(A) It works as intended for all values of element.
(B) It fails for all values of element.
(C) It fails if element is greater than the first item in list and works in all other cases.
(D) It fails if element is smaller than the last item in list and works in all other cases.
(E) It fails if element is either greater than the first item or smaller than the last item in list and works in all other cases.