Skip to content

Instantly share code, notes, and snippets.

@EricGustin
Created August 2, 2020 03:19
Show Gist options
  • Select an option

  • Save EricGustin/01f861913a45d2d7b16b97e8a98cbf96 to your computer and use it in GitHub Desktop.

Select an option

Save EricGustin/01f861913a45d2d7b16b97e8a98cbf96 to your computer and use it in GitHub Desktop.
Operation Example Big O Time Complexity
Index: dict[k] O(1)
Assign: dict[k] = v O(1)
Length: dict(lst) O(1)
Pop: dict.pop(k) O(1)
Pop item: dict.popitem() O(1)
Get a value: dict.get(k) O(1)
Get keys: dict.keys() O(1)
Clear: dict.clear() O(1)
Construct: dict = dict(keyword arguments) O(length of keyword arguments)
Delete: del dict[k] O(1)
Iteration: for k in dict: O(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment