Implementation of a persistent binary tree