Skip to content

Instantly share code, notes, and snippets.

@farrajota
Last active May 3, 2021 07:57
Show Gist options
  • Save farrajota/193c18558c9701d09f358f75ae7cdb89 to your computer and use it in GitHub Desktop.
Save farrajota/193c18558c9701d09f358f75ae7cdb89 to your computer and use it in GitHub Desktop.
Efficient data structures in python

Here I've put the most important data structures I could find with the most efficient implementations in Python I am aware of. Although this is a continuous process and many structures do not have any implementation reference available yet, if you happen to know a more efficient algorithm to implement one or more of this structures in Python (or any language) feel free to ping me :).

Basic Data Structures

Data Structure Python
Arrays

numpy

Tensorflow

PyTorch

Linked Lists Built-in List
Skip lists TODO
Stacks Built-in List
Queues Built-in List
Hash Tables / Maps Built-in Dict
Sets Build-in Set
Trees TODO
Heaps

Core-lib heapq

xheap

Sources and Useful Links

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