LoslegenKostenlos loslegen

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

Codeoptimierung in Java

Kurs anzeigen

Interaktive Übung

In dieser interaktiven Übung kannst du die Theorie in die Praxis umsetzen.

Übung starten