联系人管理中的时间复杂度
在您刚刚完成的上一个练习中的联系人管理应用里,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;
}
本练习是课程的一部分
