Re: an old worn interview question
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Mon, 17 Sep 2007 16:29:49 -0700
Tegiri Nenashi <TegiriNenashi@xxxxxxxxx> writes:
"given a graph of pointers, can you find a loop there"
I must admit that during 20 or so years of programming I never came
across any practical program that required finding a loop in the
directed graph. I suspect that finding a loop is really a part of
bigger task such as finding transitive closure of a graph. And the
tricks of finding a single loop provide no insight how to solve bigger
problem. So, any counter examples of an interesting problem, or an
algorithm that requires finding a single loop in the graph?
In traversing a directory, it is useful to be able to detect a
directory loop (caused by symlinks). GNU grep, for example, does
this, as do several other GNU programs (see cycle-check.[ch] in
http://cvs.savannah.gnu.org/viewvc/gnulib/lib/?root=gnulib). I
don't know whether this falls under your qualifiers, but it's
what comes to mind.
--
Ben Pfaff
http://benpfaff.org
.
- References:
- an old worn interview question
- From: Tegiri Nenashi
- an old worn interview question
- Prev by Date: Re: an old worn interview question
- Next by Date: Re: an old worn interview question
- Previous by thread: Re: an old worn interview question
- Next by thread: Re: an old worn interview question
- Index(es):
Relevant Pages
|