I would do the `root is null` check here instead of in `insert` because `root = insert(root, element)` looks like your altering root on every insert.