Skip to content

Instantly share code, notes, and snippets.

@cyprienc
cyprienc / maxsumtree.py
Last active May 6, 2021 14:57
MaxSumTree Python
from typing import Optional, TypeVar, Generic
T = TypeVar("T")
K = TypeVar("K")
class Node(Generic[K, T]):
def __init__(self, element: T, key: K, priority: float, parent: Optional["Node"] = None):
self.element: T = element
self.key: K = key