Re: A graph application
From: Malcolm (malcolm_at_55bank.freeserve.co.uk)
Date: 10/13/04
- Next message: Keith Thompson: "Re: bit masking"
- Previous message: Malcolm: "Re: how much of C is enough?"
- In reply to: candy: "A graph application"
- Next in thread: QNils_O=2E_Sel=E5sdal=22?=: "Re: A graph application"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: A graph application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 13 Oct 2004 21:49:16 +0100
"candy" <candy_init@yahoo.com> wrote
> I have to make a program in C while using graphs.The aim of the project
> is to search the contents of a computer in the lowest possible time.
> Can you please tell me how I can do this while using graphs.
> Basically i have no idea that how the inputs can be given to graphs.
>
Basically you are starting at the root directory, pulling out all files that
match your search criteria, and then doing the same recursively to all
sub-directories.
The fun comes when sub-directories are allowed to contain references to
parent directories, creating a loop.
Depending on your system, you might be able to maintain a fully-qualified
directory list, from root to the directory you are currently searching, and
check for loops against that. This however is rather cheating.
What you can do is keep track of recursion depth, then start at the root and
search downwards, looking for loops. If you don't find a loop, the directory
is not a link to a parent, and you can continue as normal.
However how do you distinguish an apparent loop from a sub-directory set up
to look like a parent? This would only happen if someone was deliberately
trying to fool your program. You could set a limit of, say, 1000 iterations
before you accept that the loop is genuinely a loop.
- Next message: Keith Thompson: "Re: bit masking"
- Previous message: Malcolm: "Re: how much of C is enough?"
- In reply to: candy: "A graph application"
- Next in thread: QNils_O=2E_Sel=E5sdal=22?=: "Re: A graph application"
- Reply: QNils_O=2E_Sel=E5sdal=22?=: "Re: A graph application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|