Skip to content

Instantly share code, notes, and snippets.

@2color
Last active December 2, 2021 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2color/012f038025410eedae996f0ab134f1e2 to your computer and use it in GitHub Desktop.
Save 2color/012f038025410eedae996f0ab134f1e2 to your computer and use it in GitHub Desktop.

Comparing B-Tree and Hash indices

Operation B-Tree Hash
Lookup single record O(log(n)) O(1)
Lookup range O(log(n)) O(n) full table scan
Insertion O(log(n) O(1)
Deletion O(log(n) O(1)

image hashmap image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment