Lets assume dir a has dir b which has dir c.
In a recursive deletion of these directories we can't "just delete" dir a. We must first delete dir c (and any file it has, if it has), then dir b (and any file it has, if it has) and only then could we delete dir a.

This seems to me "from bottom to top", time and again.
Is recursiveness always from bottom to top?

  • 3
    $\begingroup$ an easy counter example is creating those directories : you first need to create dir a to be able to create dir b, etc. $\endgroup$ Feb 20, 2023 at 10:58
  • $\begingroup$ @AloisChristen if I understand you correctly, this is an easy counter example for recursiveness from top to bottom (opposite direction). $\endgroup$
    – obligatory
    Feb 21, 2023 at 3:50
  • $\begingroup$ I think I should read about "head recursion" and "tail recursion". $\endgroup$
    – obligatory
    Feb 22, 2023 at 7:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.