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

Grundlegende Datenstrukturen-Dokumentation
Grundlegende Datenstrukturen
Core ConceptsHow It WorksImplementationComplexity AnalysisPractice ProblemsReal-World Use
Diskussionen

Grundlegende Datenstrukturen-Anleitung · 4/6

Complexity Analysis

Dieses Kapitel ist vorerst nur auf Englisch verfügbar.

Big-O tells you how cost grows with n, the number of stored items. For basic data structures the interesting part is that the same operation can be O(1) on one structure and O(n) on another, and that some O(1) figures are averages or amortized rather than guaranteed.

Operation costs side by side

OperationDynamic arrayLinked list (doubly)Deque (ring buffer)Hash table
Access k-th itemO(1)O(n)O(1)not supported
Search by valueO(n)O(n)O(n)O(1) average by key
Insert / delete at endO(1) amortizedO(1)O(1) amortizedn/a
Insert / delete at frontO(n)O(1)O(1) amortizedn/a
Insert / delete in the middleO(n)O(1) once the node is foundO(n)n/a
Insert / delete by keyn/an/an/aO(1) average, O(n) worst
Extra memory per itemsmall (spare capacity)two pointers per nodesmallbucket array plus chain nodes

Stacks and queues are restrictions of these structures, so a stack on a dynamic array has O(1) amortized push and pop, and a queue on a ring buffer or linked list has O(1) enqueue and dequeue.

Amortized O(1) append

A single append to a full dynamic array copies all n items, which is O(n). Over a sequence of n appends with doubling, the copies are 1 + 2 + 4 + ... + n/2 + n, which is less than 2n. Total work is O(n), so the cost per append is O(1) amortized.

The growth factor matters. Growing by a constant amount (say 10 slots each time) makes the copies 10 + 20 + 30 + ..., which is O(n squared) in total. Any constant multiplier greater than 1 keeps appends O(1) amortized; libraries trade memory for speed by choosing 1.5, 2 or a small over-allocation as CPython does.

def total_copies(n, grow):
    size, cap, copies = 0, 1, 0
    for _ in range(n):
        if size == cap:
            copies += size
            cap = grow(cap)
        size += 1
    return copies

n = 100_000
print("x2   :", total_copies(n, lambda c: c * 2))       # about 1.3 * n
print("x1.5 :", total_copies(n, lambda c: c + c // 2 + 1))
print("+10  :", total_copies(n, lambda c: c + 10))      # about n * n / 20
Fragen zu diesem Kapitel?
Vorheriges KapitelImplementationNächstes KapitelPractice Problems

Hash tables: average vs worst case

With m buckets and n keys, the load factor is alpha = n / m. If the hash function spreads keys evenly, the expected chain length is alpha, so a lookup costs O(1 + alpha). Keeping alpha below a constant (0.75 in Java's HashMap, 1.0 by default in C++'s std::unordered_map) makes it O(1) on average. Resizing costs O(n) when it happens, but like array growth it is O(1) amortized per insert.

The worst case is O(n): if every key lands in one bucket, the table degenerates into a list. This happens with a poor hash function or with adversarial input crafted to collide (hash flooding). Python randomizes string hashes per process for this reason, and Java's HashMap turns very long chains into balanced trees so the worst case becomes O(log n).

Measuring it yourself

Complexity tables are easy to verify with a timer. Removing from the front is the classic trap:

from collections import deque
from timeit import timeit

def drain_list(n):
    items = list(range(n))
    while items:
        items.pop(0)          # shifts every remaining item

def drain_deque(n):
    items = deque(range(n))
    while items:
        items.popleft()       # moves one index

n = 100_000
print("list.pop(0)    ", timeit(lambda: drain_list(n), number=1))
print("deque.popleft()", timeit(lambda: drain_deque(n), number=1))

The list version is quadratic in total and at this size is often a hundred times slower or more. Membership tests show the hash table advantage:

from timeit import timeit

items = list(range(10_000))
as_set = set(items)
probes = range(0, 20_000, 7)
print("list:", timeit(lambda: sum(p in items for p in probes), number=1))
print("set :", timeit(lambda: sum(p in as_set for p in probes), number=1))

Python's built-in types

TypeOperationAverage cost
listx[i], append, pop()O(1) (append amortized)
listinsert(0, x), pop(0), x in listO(n)
dequeappend, appendleft, pop, popleftO(1)
dequed[i] in the middleO(n)
dict / setget, set, delete, inO(1) average, O(n) worst

Space

All five structures use O(n) space, but the constants differ. A dynamic array may hold up to about twice the slots it needs right after growing. A doubly linked list stores two pointers per item, which on a 64-bit machine is 16 bytes of overhead before counting the value. Hash tables cap the load factor at a limit such as 0.75 or 1, so many buckets stay empty, and chaining adds a node per entry.

Summary

Arrays give O(1) indexing and amortized O(1) appends, linked structures give O(1) splicing at known positions, and hash tables give O(1) average key operations with an O(n) worst case. Amortized and average figures are reliable in practice as long as growth is geometric and the hash function spreads keys well; measure when in doubt.

0 Kommentare

Top-KommentareNeueste zuerst

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