---
title: 'Big O explained with a deck of cards'
source: 'https://youtube.com/watch?v=WbF2bLbAUik'
video_id: 'WbF2bLbAUik'
date: 2026-07-14
duration_sec: 0
---

# Big O explained with a deck of cards

> Source: [Big O explained with a deck of cards](https://youtube.com/watch?v=WbF2bLbAUik)

## Summary



## Transcript

if you want to get a job as a programmer you need to know Big O imagine you have a shuffled deck of cards if you want to pop one card off the stack that's extremely fast or o of one constant time but if you then want to count the cards you'll need to Loop over the entire deck resulting in O of n or linear time but now let's imagine we need to sort the deck in perfect order that's going to require a strategy or algorithm like bubble sort where we Loop over the deck repeatedly and swap out adjacent cards until the entire thing is perfectly sorted worst case we Loop over it 52 times giving us o of n^ s or quadratic time alternatively if you're stupid you could throw the cards up in the air and hope that they land perfectly sorted on the ground that's called BOGO sort and gives you o of n factorial the worst possible time complexity but now we want to find the eight of hearts in the sorted deck instead of looping through every card you could do a binary search by splitting the deck in the middle if the shown card is greater than nine go left otherwise go right continue that process to cut your work in half after every step thus giving you o of log n or logarithmic time
