Skip to content

Instantly share code, notes, and snippets.

View EdmundMartin's full-sized avatar
🎯
Focusing

Edmund Martin EdmundMartin

🎯
Focusing
View GitHub Profile
@EdmundMartin
EdmundMartin / btree.py
Created November 9, 2019 22:47 — forked from MartinThoma/btree.py
a pure-python B tree implementation
import bisect
import itertools
import operator
class _BNode(object):
__slots__ = ["tree", "contents", "children"]
def __init__(self, tree, contents=None, children=None):
self.tree = tree
self.contents = contents or []
@EdmundMartin
EdmundMartin / bplustree.py
Created November 10, 2019 20:41 — forked from savarin/bplustree.py
Python implementation of a B+ tree
class Node(object):
'''
Base node object.
Each node stores keys and values. Keys are not unique to each value, and
as such values are stored as a list under each key.
Attributes:
order (int): The maximum number of keys each node can hold.
'''