Use the loop function in the AVL tree
Sampling with R