Determine that the processes are iterative or recursive, Programming Languages

Each of the following two procedures defines a method for adding two positive integers in  terms of the procedures inc, which increments its argument by 1, and dec, which decrements its argument by 1:

(define (plus1 a b)

(if (= a 0)

b

(inc (plus1 (dec a) b))))

(define (plus2 a b)

(if (= a 0)

b

(plus2 (dec a) (inc b))))
 
Using the substitution model, illustrate the process generated by each procedure in evaluating (+ 2 5). Are these processes iterative or recursive?

Posted Date: 3/22/2013 5:11:24 AM | Location : United States







Related Discussions:- Determine that the processes are iterative or recursive, Assignment Help, Ask Question on Determine that the processes are iterative or recursive, Get Answer, Expert's Help, Determine that the processes are iterative or recursive Discussions

Write discussion on Determine that the processes are iterative or recursive
Your posts are moderated
Related Questions
1) Write a program that takes an input value (for example, a number 5). The output should be sum of all numbers from 1 to the value input by the user (in this example, the output w

Write three functions, statistics, average, and sD as follows. The statistics function returns no value and has six parameters: four scores followed by their average and standard d

We next require taking a look at arithmetic involving matrices. We'll begin with addition and subtraction of two matrices. Therefore, assume that we have two n x m matrices, which

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

2. Design an ER diagram for an IT training group database that will meet the information need’training programme. Clearly indicate the entities, relationships and the key constrain

Procedure-oriented programming (POP):- This is a top-down programming approach, where the problem is viewed as a sequence of tasks to be done such as calculating, printing etc. A n

1. Write the dual of the above max-?ow problem. 2. Solve both problems with AMPL, and for each print the values of the vari- ables and the values of the dual variables (if a p

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Matlab Assignment # For each of the three datasets (data1.txt, data2.txt, and data3.txt in bnhw2q2.zip), cluster the data using k-means in Matlab, with k=2, 3, 4 and 5 using the pr

NOTE: You will only submit the University.java and EmptyFileException.java files (inside P3.zip/tar) NOTE on null objects:. From Project 1: Since the array of students in the Cou