|
-
January 3rd, 2006, 09:20 AM
#1
Recursive vs Iterative
Hi everyone
Can anyone help me to clear my understanding? As we know implementing divide and conquer recusively requires only simple coding and iteratively requires complex coding. But what about complexity?
Recursive will take more space before of stacking the entire structures and iterative take less space. But thats relating to space. I am thinking about time complexity. Which one works faster? (Consider large input samples).
-
January 3rd, 2006, 11:16 AM
#2
Re: Recursive vs Iterative
The complexity of a well-written recursive function is usually the same as the complexity of a well-written iterative function, but of course it depends on the specific task at hand.
However, in most languages, a recursive solution is slower because calling a new function creates a certain amount of overhead that iterative solutions do not suffer from.
Errare humanum est, ergo non sum humanus.
-
January 7th, 2006, 07:47 PM
#3
Re: Recursive vs Iterative
usually itterative is faster.
Mike
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|