DevPinoy.org
A Filipino Developers Community

>>> First two to make 3 wins! <<<

Trivia for the weekend: Get the number of occurrences of text in a string

rated by 0 users
This post has 17 Replies | 0 Followers

Top 25 Contributor
Posts 80
Points 1,210
correct me if im wrong , but the problem stated no looping required . is recursion not looping , in my opinion looping can be implemented using iteration (for,while)  or recursion .

need feedback on this.. thanks.

 a peek into my trashVin....

m3x files

  • | Post Points: 20
Top 25 Contributor
Posts 232
Points 3,130
^^^ well you could say that recursion is a form of implicit looping whereas the (for, while) are all explicit loop constructs.. why implicit? the loop isn't obvious, recursion calls itself to loop.  that's why there was a solution of just deducting the length of target string from the source string..

Bonski's Box

  • | Post Points: 20
Top 10 Contributor
Posts 498
Points 8,375
According to programming language standards, recursion is a form of repeating a task by means of calling itself (also known as self-branching), where the repeat is determined by task-reduction (action, recurse, case).

Looping on the other hand is performing a set of repeated task in complete circuit (iterator, condition, count), and the branch must be in a circuit, otherwise it will prematurely terminate a loop.

That's why in programming language standards (at least in the C family of programming language), recursion (recursive calls) is not considered as a loop, becuase it doesn't need to complete a circuit to repeat a task.

Regards,

-chris
Chris Vega This posting is provided "AS IS" with no warranties, and confers no rights My Weblog|Visit MSDN Community
  • | Post Points: 5
Page 2 of 2 (18 items) < Previous 1 2 | RSS

Copyright DevPinoy 2005-2008