Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Aufwandsberechnung

Empfohlene Antworten

Veröffentlicht

Hallo,

kann mir vielleicht jemand anhand eines Beispiels erklären wie ich den Aufwand eines Algorithmus berechnen kann?

Ich finde leider im Netz keine guten Beispiele :(

loop1(n) {

m = 1;

i = 0;

while (m < n) {

while (i < m) {

i = i + 1;

}

m = m + i;

}

}

Vielen Dank für jede Hilfe :)

Vielen Dank, die Seite war sehr hilfreich =)

Ich habe aber noch eine Frage zu folgenden Algorithmen:

loop5(n) {

m = n;

i = 4 * n;

while (i > 4) {

m = m + n;

i = i - 4;

}

while (m > 0) {

m = m - 2;

}

}

die erste Schleife wird nach meinen Überlegungen n- mal durchlaufen und die zweite 2n mal.

Die richtige Lösung ist jedoch O(n^2).

Werden die zwei Aufwandsklassen auch multipliziert wenn sie nicht verschachtelt sind?

loop2(n) {

if (n > 0) {

loop2(n - 500);

} else if (n < 0) {

loop2(n + 2);

}

}

Die Schleife terminiert nur für gerade Zahlen. Ich habe als Aufwandsklasse O(n) raus, kommt das hin?

Vielen Dank :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.