LoslegenKostenlos starten

Zeitkomplexität in der Kontaktverwaltung

In der Kontaktverwaltungsanwendung, die du in der vorherigen Übung implementiert hast, welche Zeitkomplexität hatte die Methode 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;
}

Diese Übung ist Teil des Kurses

<Kurs>Codeoptimierung in Java</Kurs>
Kurs ansehen

Interaktive praktische Übung

Verwandle Theorie mit einer unserer interaktiven Übungen in die Praxis

Übung starten