tailieunhanh - Thuật toán Algorithms (Phần 4)

Tham khảo tài liệu 'thuật toán algorithms (phần 4)', khoa học tự nhiên, toán học phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 2. Arithmetic Algorithms for doing elementary arithmetic operations such as addition multiplication and division have a. very long history dating back to the origins of algorithm studies in the work of the Arabic mathematician al-Khowdrizmi with roots going even further back to the Greeks and the Babylonians. Though the situation is beginning to change the of many computer systems is their capability for doing fast accurate numerical calculations. Computers have built-in capabilities to perform arithmetic on integers and floating-point representations of real numbers for example Pascal allows numbers to be of type integer or with all of the normal arithmetic operations defined on both types. Algorithms come into play when the operations must be performed on more complicated mathematical objects such as polynomials or matrices. In this section we ll look at Pascal implementations of some simple algorithms for addition and multiplication of polynomials and matrices. The algorithms themselves are well-known and straightforward we ll be examining sophisticated algorithms for these problems in Chapter 4. Our main purpose in this section is to get used to treating mathematical objects as objects for manipulation by Pascal programs. This translation from abstract data to something which can be processed by a computer is fundamental in algorithm design. We ll see many examples throughout this book in which a proper representation can lead to an efficient algorithm and vice versa. In this chapter we ll use two fundamental ways of structuring data the array and the linked list. These data structures are used by many of the algorithms in this book in later sections we ll study some more advanced data structures. Polynomials Suppose that we wish to write a program that adds two polynomials we would 23 24 CHAPTER 2 like it to perform calculations like i 2x - 3z3 2 -x 3 x 3z3. In general suppose we wish our program to be able to compute r z p x q x where p and q are polynomials

TỪ KHÓA LIÊN QUAN