/*
 * Iterative DepthFirst file list (c) Victor Yodaiken 2013
 *
 * "Not the way we do it in Brooklyn" - Dave "Kinch" Arnow. 
 *
 *
 * Data structure is P - the current path, with some aux data
 *
 * Two basic operations:
 * 1) Lp(P) - starts at path P and extends it to the leftmost
 * reachable file/directory
 * 2) IterateDF(P) iterates by advancing a path to the next in depth 
 * first order
 *
 * So program is
 *
 * Initialize(P);
 * do{
 * PrintPath(P);
 * }while(IterateDF(P) != EOF)
 *
 *
 * Horribly inefficient - can be cured by caching positions in directory
 * entries.
 *
 * */
Link to Code
Paths versus Recursion
Tagged on: