The insertFirst and insertLast methods should both run in constant time.