Zum Hauptinhalt springen
ProdukteDesktop-WerkzeugeTASTECADZeichnungsprüfungTASTEFILESDateiverwaltungTASTEFTPDateiübertragungTASTESSHRemote-ArbeitsbereichTASTEZIPKomprimieren und EntpackenEntwicklerwerkzeugeTASTECODEIntegrierte Entwicklungsumgebung für RustTASTESTUDIOIntegrierte Entwicklungs- und TestumgebungTASTEETLDatenintegration (ETL)ServerTASTEREMOTERemote-Desktop-ServerTASTEGEOGeodatenserverTASTEMAILE-Mail-ArbeitsbereichErste SchritteDownloadsDokumentationKaufenAlle Produkte
Marktplatz
Neuigkeiten
TechnikNeuigkeitenEntwickler-News von heuteEntwicklerdokuProgrammiersprachenRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngularServer-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressApp- & Desktop-FrameworksTauriFlutterReact NativeElectronAlgorithmenAlgorithmus-GrundlagenKernalgorithmenFortgeschrittene AlgorithmenAlgorithmen für die Praxis
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcaseCommunity-Leitfaden
ZusammenarbeitWissenstransferWebsite-AufbauDesktop-App-AufbauRelease- und ZahlungspipelineVertriebspartnerKontakt
DiensteRemote-DesktopIndividuelle Installationspakete
TASTEDEV
Produkte

Desktop-Werkzeuge

TASTECADKomplexe Zeichnungen, mühelos geöffnetTASTEFILESNur die Dateien, die zählen – in BestzeitTASTEFTPDer aufgeräumteste Weg für Ihre DateienTASTESSHDie stärkere Verbindung zu Ihren ServernTASTEZIPSchneller packen, sicherer entpacken

Entwicklerwerkzeuge

TASTECODERust-Apps bearbeiten, bauen, debuggen und testen – alles in einem FensterTASTESTUDIOVom Bearbeiten bis zu Remote-Tests und freigegebenen KI-KorrekturenTASTEETLDaten bewegen, die Werte im Blick

Server

TASTEREMOTEEin Remote-Desktop auf Ihrem eigenen ServerTASTEGEOEin GeoServer-kompatibler Geodatenserver, neu aufgebaut in RustTASTEMAILIhre E-Mail wieder in Ihrer Hand

Erste Schritte

DownloadsNeueste Versionen aller ProdukteDokuSo nutzen Sie jedes ProduktKaufenAbos und DauerlizenzenAlle ProdukteAlle Produkte im Überblick
Alle Produkte
MarktplatzNeuigkeiten
Technik

Neuigkeiten

Entwickler-News von heuteOffizielle Meldungen zu Sprachen, Frameworks, GitHub und KIEntwicklerdokuAnleitungen zu Sprachen, Frameworks und Algorithmen

Programmiersprachen

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Web-Frontend-FrameworksNext.jsReactVue.js · NuxtSvelteKitAngular
Server-FrameworksSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
App- & Desktop-FrameworksTauriFlutterReact NativeElectron

Algorithmen

Algorithmus-GrundlagenKomplexitätsanalyse · Sortieren · Suchen · Grundlegende Datenstrukturen · Bäume und HeapsKernalgorithmenGraphtraversierung · Kürzeste Wege und minimale Spannbäume · Dynamische Programmierung · Greedy-Algorithmen · Teile und herrsche · BacktrackingFortgeschrittene AlgorithmenZeichenkettenalgorithmen · Mathematik und Zahlentheorie · Bitmanipulation · Segmentbäume · Union-FindAlgorithmen für die PraxisStrategie für Coding-Interviews · LRU-Cache · Rate Limiting · Konsistentes Hashing
Alle Entwicklungsdokumente
Community
ProjekteEntwickler und Projekte entdeckenEntwicklungslogsEntscheidungen und ErkenntnissePromptsWiederverwendbare AnweisungenProbleme mit KI-ToolsProbleme und Workarounds für Claude, Codex, GeminiShowcaseFertige ErgebnisseCommunity-LeitfadenWie wir offen entwickeln
Zusammenarbeit
WissenstransferNative Apps mit Rust und eguiWebsite-Aufbau10 Sprachen, Konten, Dokumentation und DownloadsDesktop-App-AufbauRust und egui, ohne WebViewRelease- und ZahlungspipelineSignatur, MSI, deb, rpm, AppImage, PrüfsummenVertriebspartnerEmpfehlen und 30 % erhaltenKontaktEntwicklung, Partnerschaft, Investition
Dienste
Remote-DesktopIhren Computer im Browser erreichenIndividuelle InstallationspaketeNur nötige Funktionen, Einstellungen vorab
Kaufen
DE
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Anmelden
Anmelden
TASTEDEV

Von kleinen Werkzeugen zu besserer Entwicklung.

support@tastedev.netTASTEDEV unterstützen
ProdukteProduktübersichtKaufenDokuDownloadsMarktplatzSupport
CommunityProjekteEntwicklungslogsPromptsProbleme mit KI-ToolsShowcase
RichtlinienDatenschutzerklärungNutzungsbedingungenAbo-BedingungenRückerstattungCommunity-Richtlinien
KontoAnmeldenRegistrieren
Besucher
Heute
012345678901234567890123456789012345678901234567890123456789
Gestern
012345678901234567890123456789012345678901234567890123456789
Aufrufe gesamt
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
Firma
GXSOFT
Vertretungsberechtigt
CHOI YOUNG GU
Handelsregisternummer
853-44-00368
Anschrift
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefon
+82-10-4404-1523
E-Mail
whitecalvin@tastedev.net
Datenschutzbeauftragter
CHOI YOUNG GU

© 2026 TASTEDEVProduktinformationen basieren auf verifizierten Entwicklungsquellen.Veröffentlicht · wird verbessert

Komplexitätsanalyse-Dokumentation
Komplexitätsanalyse
Complexity Analysis ConceptsHow It Works: From Counting Operations to the Master TheoremImplementation: Measuring Three Growth RatesComplexity: Common Classes, Amortized Cost and SpacePractice ProblemsReal-World Use
Diskussionen

Komplexitätsanalyse-Anleitung · 4/6

Complexity: Common Classes, Amortized Cost and Space

Dieses Kapitel ist vorerst nur auf Englisch verfügbar.

This chapter compares the growth rates you meet most often, uses amortized analysis to explain why appending to a dynamic array is "O(1) on average", and covers space complexity including the recursion stack.

Common complexity classes

ClassNameTypical exampleWhen n doubles
O(1)ConstantArray indexing, hash lookup (average)Unchanged
O(log n)LogarithmicBinary search, balanced tree lookupOne more step
O(n)LinearLinear search, summing2x
O(n log n)LinearithmicMerge sort, heapsortA bit more than 2x
O(n²)QuadraticAll pairs, insertion sort (worst)4x
O(2ⁿ)ExponentialListing all subsetsSquared (2x per extra element)
O(n!)FactorialListing all permutationsExplodes

Rough operation counts make the gaps obvious:

nlog₂ nn log₂ nn²2ⁿn!
103.3331001,024about 3.6 × 10⁶
1006.666410⁴about 1.3 × 10³⁰about 9.3 × 10¹⁵⁷
1,00010about 10⁴10⁶about 10³⁰¹out of reach
10⁶20about 2 × 10⁷10¹²out of reachout of reach

As a rule of thumb, compiled languages do around 10⁸ simple operations per second and Python around 10⁷. At n = 10⁵ an O(n²) algorithm needs 10¹⁰ operations, tens of seconds even in C++. That estimate is how you read the input limits of a coding problem:

Input size nRoughly feasible in one second
about 10O(n!),
Fragen zu diesem Kapitel?
Vorheriges KapitelImplementation: Measuring Three Growth RatesNächstes KapitelPractice Problems
O(2ⁿ · n)
about 20O(2ⁿ)
about 500O(n³)
about 5,000O(n²)
10⁵ to 10⁶O(n log n), O(n)
largerO(log n), O(1)

Amortized analysis: appending to a dynamic array

Python's list, C++'s std::vector and Java's ArrayList allocate a bigger array and copy every element when the current one is full. That one append costs O(n), but if capacity grows by a constant factor, n appends cost O(n) in total, so each costs O(1) amortized.

Doubling the capacity copies 1 + 2 + 4 + ... elements; the last term is smaller than n, so the sum is always below 2n. Growing by a fixed amount instead (say 10 slots) copies 10 + 20 + 30 + ... elements, which adds up to O(n²).

def total_copies(n, grow):
    capacity, size, copies = 1, 0, 0
    for _ in range(n):
        if size == capacity:
            copies += size              # copy existing elements to the new array
            capacity = grow(capacity)
        size += 1
    return copies

for n in (1_000, 10_000, 100_000):
    doubling = total_copies(n, lambda c: c * 2)
    plus_ten = total_copies(n, lambda c: c + 10)
    print(n, doubling, plus_ten)
# 1000 1023 49600
# 10000 16383 4996000
# 100000 131071 499960000

Doubling stays proportional to n (under 2n), while growing by ten multiplies the copies by about 100 when n grows tenfold. Unlike average-case analysis, amortized analysis involves no probability: it is a guarantee over the whole sequence of operations. CPython's list grows by about 1.125x plus a small constant, which still gives amortized O(1). You can watch the allocation change only occasionally:

import sys

items, last = [], sys.getsizeof([])
for i in range(40):
    items.append(i)
    size = sys.getsizeof(items)
    if size != last:
        print(len(items), size)   # only lengths where a reallocation happened
        last = size

Space complexity

Total space includes the input; auxiliary space excludes it. An "in-place" algorithm usually means O(1) or O(log n) auxiliary space. Every recursive call uses a stack frame, so recursion depth is a space cost.

def sum_recursive(items, i=0):      # time O(n), stack space O(n)
    if i == len(items):
        return 0
    return items[i] + sum_recursive(items, i + 1)

def sum_iterative(items):           # time O(n), auxiliary space O(1)
    total = 0
    for x in items:
        total += x
    return total

print(sum_iterative(range(100_000)))   # 4999950000
# sum_recursive(list(range(100_000))) exceeds the default recursion limit (about 1000): RecursionError
AlgorithmTime (worst)Auxiliary space
Linear searchO(n)O(1)
Binary search (loop)O(log n)O(1)
Binary search (recursive)O(log n)O(log n)
Merge sortO(n log n)O(n)
QuicksortO(n²), average O(n log n)O(log n) on average
Two-sum (hash map)O(n) averageO(n)

Summary

  • Differences between classes dwarf constant factors as n grows, and input limits tell you which class you need.
  • Dynamic arrays grow by a factor, which makes append amortized O(1); growing by a fixed amount makes it O(n²) overall.
  • Space complexity includes auxiliary memory and recursion depth.

0 Kommentare

Top-KommentareNeueste zuerst

Anmelden · Melde dich an, um einen Kommentar zu schreiben.