State 2 similarities and one difference between recursion and iteration
similarities
recursion and iteration are similar un such a way that both are based on a control structure: recursion has a selection structure; Iteration has a repetition structure
both are similar: they involve repetition: repetition is achieved in recursion through repeated method calls; Iteration uses a repetition structure explicitly.
difference
iteration occurs when we execute a loop repeatedly until a certain condition is met. Recursion is a method call in which the called method is similar to making the call.
Comments
Leave a comment