Get the latest tech news

Python Big O: Time complexities of different data structures in Python


The time complexity of common operations on Python's many data structures.

Time complexity is one of those Computer Science concepts that's scary in its purest form, but often fairly practical as a rough " am I doing this right" measurement. Python's collections module includes a Counter class which can efficiently count the number of times each item occurs within a given iterable. When you do need a data structure that's optimized for specific operations, you can always lookup an implementation online or find a PyPI module (such as sortedcollections).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of python

python

Photo of Python Big O

Python Big O

Photo of time complexities

time complexities

Related news:

News photo

Py2wasm – A Python to WASM Compiler

News photo

Ruby vs. Python comes down to the for loop (2021)

News photo

GNU Portability Library's Tool Rewritten In Python For 8~100x Better Performance