red-black tree: use a cache for the last node

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>