wrote split-at-root functions for both :root-leaf and :root-nonleaf