B-tree codes