Preorder binary-tree traversal
List folders with each folder before its subfolders. Record the folder itself first, then visit its left branch followed by its right branch.
Drag a child to either side of its parent. The L and R edge labels show which branch the program will visit.
Time is O(V). Call depth equals tree height.