連絡先管理における時間計算量
前の演習で実装した連絡先管理アプリケーションにおいて、findContact メソッドの時間計算量はどれでしょうか?
public Contact findContact(String name) {
// Complete loop to search through contacts
for (Contact contact : contacts) {
if (contact.getName().equals(name)) {
// Return the match
return contact;
}
}
return null;
}
この演習はコースの一部です
