Convert paris from rbtree to qsorted array