title: Non-recursive way to list files in directory and subdirectories without using stack/queue
body: <p>During an interview, I was asked to list the names of files in a directory and its subdirectories¹ without using neither recursion, nor stack or queue.</p>
  
  <p>Since the only non-recursive way I know uses a stack, I was unable to answer this question.</p>
  
  <p>The interviewer explained the solution, but I was unable to understand it. The only thing I remember is that it involved two methods instead of one.</p>
  
  <p>What is this approach which allows listing files in a directory and its subdirectories with no recursion and no stack or queue?</p>
  
  <hr>
  
  <p><sup>¹ The solution is language agnostic. The list of subdirectories is provided by a <code>ListDirectories(string directoryPath)</code> method, and the files - by <code>ListFiles(string directoryPath)</code>. We don't know in advance the depth of subdirectories.</sup></p>