Hi, Dane
I suggest to take any basic CS book and check there examples for n!
calculation - which is classic example of recursive solution of the problem.
Basically it means, that your definition of recursive function should call
itself with arguments, which allow to reduce complexity of solved task
for example:
int Factorial(int n) {
if (n<0) throw new Exception("I don't know how to calculate factorial for
negative number!");
if (n=0) return 0;
return n*Factorial(n-1);
}
Try to run this in debugger, say as Factorial(4), and see step by step what
happens. Just don't call it with too big N, you might get overflow or stack
exception.
Same logic would apply to traversing trees like directory structure
HTH
Alex
"Dane Carty" <da**@REMOVEMEcartyonline.net> wrote in message
news:Qr*******************@front-1.news.blueyonder.co.uk...
Hi,
Using a TreeView component to create a tree of the directories within my
file system.
I can't get my head around the logic of the recursion. Anyone with a
bigger brain is welcome to help!!
I want the vaild drives to be the top layer with 'children' drilling down
through the directory structure.
Many thanks in advance
Dane