Write a program that implements Algorithm 7.1 in your favorite computer language. Note that if the arrays in your language cannot start at 0, you should rewrite the algorithm as suggested in Exercise 7.9. Use test problems from Sect. 7.4.4 to test your program.
Exercise 7.9
Algorithm 7.1 is easy to implement in a computer program if the computer language has arrays whose first index is 0. All languages with some inheritance from C (e.g., C++, Java, C#, Perl, Python, Ruby) have this feature. Some languages (Matlab, for instance) use index 1 for the first element in an array. You should then rewrite Algorithm 7.1 so that the index in space (usually called i in this book) runs from 1 to n C 1 and not from 0 to n. (This rewrite might sound trivial, but a simple change from i to i C 1 very often causes errors in programs.)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here