Skip to content

Instantly share code, notes, and snippets.

@smvv
Created July 24, 2013 10:02
Show Gist options
  • Save smvv/6069349 to your computer and use it in GitHub Desktop.
Save smvv/6069349 to your computer and use it in GitHub Desktop.
pub static BTREE_MIN_DEGREE : uint = 20;
//pub static BTREE_MIN_DEGREE : uint = 2;
pub static BTREE_KEYS_LBOUND : uint = BTREE_MIN_DEGREE - 1;
pub static BTREE_KEYS_UBOUND : uint = 2 * BTREE_MIN_DEGREE - 1;
pub struct BTree<K, V> {
priv used: uint,
priv keys: [Option<K>, ..BTREE_KEYS_UBOUND],
priv nodes: [Option<TreeItem<K, V>>, ..BTREE_KEYS_UBOUND + 1],
}
pub enum TreeItem<K, V> {
TreeNode { value: ~BTree<K, V> },
TreeLeaf { value: V },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment