Min Heap for Mojo
While doing this year's Advent of Code I quickly put together functions to make a min heap in mojo because I couldn't find anything in the stdlib. It works the same as the python heapq library without having to go through the hassle of python interop and runs around 6.5x faster. Currently it only supports heappush and heappop but I might add a heapify function or MinHeap struct if anyone's interested. Hope this saves someone some time.
https://gist.github.com/mehta302/ffebd938e63ae43bd5e02bac72a0cae1
Gist
Min Heap / Priority Queue for Mojo
Min Heap / Priority Queue for Mojo. GitHub Gist: instantly share code, notes, and snippets.
0 Replies