Cấu trúc liên kết vs. cấu trúc liên tục 1. Cấu trúc liên tục yêu cầu ít bộ nhớ máy tính, thời gian và công việc lập trình khi các phần tử trong cấu trúc là nhỏ và giải thuật đơn giản ngược lại, cấu trúc liên kết sẽ tiết kiệm hơn 2. Sử dụng con trỏ và cơ chế cấp phát bộ nhớ động cho phép chương trình thích hợp với các ứng dụng có kích thước...
98 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1374 | Lượt tải: 0
In general, use recursion if A recursive solution is natural and easy to understand. A recursive solution does not result in excessive duplicate computation. The equivalent iterative solution is too complex.
19 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1245 | Lượt tải: 0
Mouse events include such user interactions as moving the mouse dragging the mouse (moving the mouse while the mouse button is being pressed) clicking the mouse buttons. The MouseListener interface handles mouse button mouseClicked, mouseEntered, mouseExited, mousePressed, and mouseReleased The MouseMotionListener interface handles mouse mov...
49 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1224 | Lượt tải: 0
We finalize the program by correcting any remaining errors, inconsistency, or unfinished methods. We want to review the methods and improve them as necessarily. One problem (which would have been identified in step 4 testing) we need to correct is the missing method for expanding the roster array when the input file includes more student entries ...
45 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1274 | Lượt tải: 0
We will write a test program to verify that the data can be read back correctly from a file. To test the read operation, the file to read the data from must already exist. We will make this test program save the data first by using the TestAddressBookWrite class from .
37 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1161 | Lượt tải: 0
In the previous two versions, we used an array data structure to maintain a collection of Person objects In the third version, we don't use an array at all. Instead, we use a Map from the Java Collection Framework to maintain a collection of Person objects. We use the person's name as the key of a Map entry and the person object as the value of ...
58 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1197 | Lượt tải: 0
Final Test Since the three operations of add, delete, and search are interrelated, it is critical to test these operations together. We try out various combinations of add, delete, and search operations. Possible Extensions One very useful extension is scanning. Scanning is an operation to visit all elements in the collection. Scanning is usef...
60 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1338 | Lượt tải: 0
Possible Extensions One is an integrated user interface where the end user can view both the input document files and the output word list files. Another is the generation of different types of list. In the sample development, we count the number of occurences of each word. Instead, we can generate a list of positions where each word appears in ...
42 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1306 | Lượt tải: 0
The purpose of Step 2 testing is to verify the correct behavior of an InputHandler. We need to test both successful and unsuccessful cases. We must verify that the door is in fact opened when the valid information is entered. We must also verify that the error message is displayed when there’s an error in input. We should test invalid cases...
41 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1212 | Lượt tải: 0
Program Review Are all the possible cases handled? Are the input routines easy to use? Will it be better if we allow different formats for entering the date information? Possible Extensions Warn the user, say, by popping a warning window or ringing an alarm, when the due date is approaching. Provide a special form window to enter data (No...
46 trang | Chia sẻ: nguyenlam99 | Ngày: 04/01/2019 | Lượt xem: 1180 | Lượt tải: 0