CNSS/NSA Infosec Professional,<br />Software Engineer
CNSS/NSA Infosec Professional,<br />Software Engineer
I don't see how that changes anything. Every recursive algorithm requires a stop condition. Without one, you have infinite recursion. And a condition implies branching logic: an if test or ternary statement.Originally posted by Sam Smoot:
As a "general" hint, I'm reading an array.
CNSS/NSA Infosec Professional,<br />Software Engineer
CNSS/NSA Infosec Professional,<br />Software Engineer
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
A try-catch block still contains branching logic (conditional expression). No matter what language you use, the computer at its core still has a decision to make: recurse again or return a result.Originally posted by praveen balaji:
Let it go past the end of the array and throw an exception. Catch the RuntimeException from the caller.
Originally posted by Sam Smoot:
Ok, this is, but isn't a homework question.
Yes, and his cat did or did not eat it.Originally posted by Kevin Stock:
Would this happen to be Schrodinger's Homework?
CNSS/NSA Infosec Professional,<br />Software Engineer
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ruth Stout was famous for gardening naked. Just like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|