If FORTRAN had been less efficient, it would have been much
more difficult to persuade the assembly-language-oriented programmers of the 1950s to try
higher-level languages. Such resistance would have slowed the development of language
theory, higher-level languages, and the productivity of the software industry.
4.2 Given what you know of computer languages, what language would be a good choice for
a Processing a file of text, such as a system error log, looking for particular types of events?
Perl, awk, sed, PHP, Ruby, and Python
b Developing an artificial intelligence application to diagnose disease, given a list of symptoms?
Lisp
Prolog
c Writing driver software for a new computer printer?
C, C#, C++
4.3 Here is a C function that computes the sum of a range of integers. You can assume that begin will
always be less than or equal to end (begin <= end):
int summation( int begin, int end ) {
int result = begin;
begin = begin + 1;
while( begin <= end ) {
result = result + begin;
begin = begin + 1;
}
return result;
}
Rewrite this function so that it uses recursion instead of iteration.
int summation( int begin, int end ) {
if( begin == end ) return begin;
return begin + summation( (begin + 1), end );
}
4.
Pages:
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506