Big O explained with a deck of cards
3-Second Blueprint (English)
- Popping one card off a deck runs in O(1) constant time, whereas counting every card requires an O(n) linear scan.
- Sorting by repeatedly swapping adjacent cards with bubble sort takes O(n²), while random bogosort degrades to O(n!).
- Splitting a sorted deck in half at each step via binary search cuts work exponentially to find a card in O(log n) time.
Big O notationO(1) & O(n) complexityBubble sort O(n²)Binary search O(log n)Bogosort O(n!)
3-Sekunden-Fazit (Deutsch)
- Das Abheben einer Karte läuft in konstanter Zeit O(1), während das Durchzählen aller Karten lineare Zeit O(n) braucht.
- Wiederholtes Tauschen von Nachbarkarten per Bubble Sort benötigt O(n²), zufälliges Bogosort sogar faktorielle Zeit O(n!).
- Binäre Suche halbiert ein sortiertes Deck bei jedem Schritt und findet eine Zielkarte in logarithmischer Zeit O(log n).
Big-O-NotationZeitkomplexität O(1) & O(n)Bubble Sort O(n²)Binäre Suche O(log n)Bogosort O(n!)
Note / Hinweis: Blueprints are AI-generated educational summaries (0% Politics · 0% Religion · 0% Brainrot) and do not constitute medical, legal, or financial advice. / KI-generierte Zusammenfassung zu Bildungszwecken – ersetzt keine medizinische, rechtliche oder finanzielle Fachberatung.