Perimeter traversal of a binary tree