If you need to recursively traverse a directory tree, there are two ways to do it:
Build up pathnames of increasing length as you go, .../.../... etc.
Use chdir to step down into each directory as you come to it, so you are never dealing with pathnames longer than two components.
The first method strikes me as more obvious, and might be more robust against untoward events like something being unmounted while you are halfway through it. On the other hand, looking over the code for the GNU find utility, I notice it uses the second method. Is there a reason for that? Any advantage of the second method that I hadn't thought of?