Fireship · @fireship

5 wild data structures every developer should know

Uploaded May 15, 2025 · Length 4:30

5 wild data structures every developer should know

Summary

This video teaches 5 unusual data structures: B tree, radix tree, rope, Bloom filter, and cuckoo hashing, explaining their use cases and benefits.

  • data structures
  • b tree
  • radix tree
  • rope data structure
  • bloom filter
  • cuckoo hashing

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    Anyone who has ever graduated from

  2. 0:01

    kindergarten should know the seven

  3. 0:03

    foundational data structures of computer

  4. 0:05

    science, which include arrays, link

  5. 0:07

    list, hashts, stacks, cues, graphs, and

  6. 0:10

    trees. But if you didn't graduate from

  7. 0:12

    kindergarten, here's a quick crash

  8. 0:13

    course. A data structure is just a way

  9. 0:15

    to organize data in a computer so you

  10. 0:17

    can do CRUD to it efficiently. Create,

  11. 0:19

    read, update, and delete it. An array is

  12. 0:21

    like a row of numbered cubbies. A linked

  13. 0:23

    list is like a treasure map of clues. A

  14. 0:26

    hash table is like a locker with your

  15. 0:27

    name on it. A stack is like a stack of

  16. 0:29

    books. A Q is like a line of kids at the

  17. 0:31

    cafeteria. A graph is a spiderweb. And a

  18. 0:34

    tree is well like a tree. The

  19. 0:36

    programming is all about solving

  20. 0:37

    problems. I've got 99 problems, but a

  21. 0:40

    data structure ain't one. But for some

  22. 0:41

    programmers, data structures do become a

  23. 0:43

    problem. And in today's video, we'll

  24. 0:45

    look at a few unusual situations where

  25. 0:47

    these simple data structures were not

  26. 0:49

    good enough or smart enough to get the

  27. 0:50

    job done. Let's start by talking about

  28. 0:52

    the B tree, not to be confused with a

  29. 0:54

    binary tree. One of the most

  30. 0:56

    exhilarating things that ever happened

  31. 0:57

    in my life was the first time I

  32. 0:58

    implemented a binary search tree, which

  33. 1:01

    prevented my algorithm's time complexity

  34. 1:02

    from going burr, turning O of N squared

  35. 1:05

    into a much faster O of login. But

  36. 1:07

    binary search trees have one problem.

  37. 1:09

    Each node in the tree can only have two

  38. 1:11

    children, which means the depth of the

  39. 1:12

    tree grows rapidly and doesn't scale

  40. 1:15

    very well for things like modern hard

  41. 1:16

    drives with massive amounts of data to

  42. 1:18

    search through. To address this problem,

  43. 1:20

    a long time ago, programmers at Boeing

  44. 1:22

    developed the self-balancing tree or B

  45. 1:25

    tree. Although nowadays, you'll mostly

  46. 1:26

    find B+ trees in file systems and

  47. 1:29

    databases. At a high level, what makes

  48. 1:31

    them special is that each node can have

  49. 1:32

    multiple children of sorted keys. These

  50. 1:35

    are called internal nodes, and they work

  51. 1:36

    like signposts that point to leaf nodes

  52. 1:39

    that hold the actual data or pointers to

  53. 1:41

    data. So, it works kind of like a binary

  54. 1:43

    tree, but greatly reduces the dis IO

  55. 1:45

    operations by cutting down the height of

  56. 1:47

    the tree. Pretty cool. But there are

  57. 1:49

    many other types of trees in nature and

  58. 1:51

    in computers like the radex tree. Like

  59. 1:53

    there are billions of IP addresses in

  60. 1:55

    the world. But have you ever wondered

  61. 1:56

    how computers route between them so

  62. 1:58

    efficiently to make the internet work? A