WEEK 7

Due Monday 18th November

 

Section 1

Time: 8:00 AM

18th November

 

Boger Ian D

Discuss the use of recursion in terms of efficiency, maintainability, writability, etc. In which cases is recursive programming good, and in which cases is it bad? Fortran does not allow recursion. What effect does this have on programming those algorithms that are best handled by recursion? (Are there situations in which Fortran cannot handle a certain task because of its lack of recursion?)?

 

Morrison Benjamin R

Consider the different approaches to arithmetic overflow adopted by C and Java. Discuss the differences in language design goals that may have led the designers to adopt different approaches.

 

 

Section 2

Time: 9:05 AM

18th November

 

Kelly David L

Read over section 6.7 in the textbook (Non-determinancy). Discuss this material with the class, and expand your discussion with interesting co-related material from outside sources. Ask the instructor for advice if necessary.

 

Sharma Amit

Loop index variables are important to calculate number of iterations. Discuss non-integer indexes and resulting round-off errors in the loops in C/C++. How it is in Fortran?

 

 

Section 3

Time: 10:10 AM

18th November

 

Dogny Trajan W

A tail-recursive function is a function in which additional computation never follows a recursion call.  Discuss the difference between iteration, recursion and tail-recursion. Give some examples.

 

Ekstrom Jeffery L

Fortran calculates the number of loop iterations in advance before the start of the loop to guarantee that the number of iterations is fixed. This is particularly important when the loop index variable is a real number. Because of roundoff when the step size has a fractional value, a loop bounds test may not work properly.

 

Consider the C program below. It numerically integrates the values of i^2 from 0.0 to 100 with step size 0.1:

 

#include <stdio.h>

main()

{ float sum, d;

  sum = 0.0;

  for (d = 0.0; d < 100.0; d += 0.1)

            sum += d*d;

  printf("integral = %f, last value = %f\n", 100.0*s*sum, d);

}

 

Compile and run the program. Is the last value of d=100 as you expect? What if you change float into double type for d?

 

Devise methods to implement correct loops in C/C++ that have non-integer step sizes. For this, consider using a separate counter like in Fortran to calculate the number of loop iterations in advance, or use scaled numbers in which the step value is always 1 but the index variable is scaled when it is used in the loop (can you use integer index variables that are scaled? What if the step size is negative?). How efficient are these implementations? What if the loop body changes the index variable? Does the method still work?

 

 

Section 4

Time: 11:15 AM

18th November

 

Coppens James H

Consider the different approaches to arithmetic overflow adopted by C and Java. Discuss the differences in language design goals that might have caused the designers to adopt the approached they did.

 

Pfenning Justin R

Compare the overloaded and polymorphism method in C/C++ and Java. If necessary, ask the instructor for advice on this topic.

 

Worley Robert M

Discuss the use of recursion in terms of efficiency, maintainability, writability, etc. In which cases is recursive programming good, and in which cases is it bad? Fortran does not allow recursion. What effect does this have on programming those things that are best handled by recursion (are there situations in which Fortran cannot handle a certain task because of its lack of recursion?)?