Duplicate elimination Because duplicate values follow the same “go left” or “go right” decisions, the insertion operation eventually compares the duplicate with a same-valued node The duplicate can then be ignored Tightly packed (or balanced) trees Each level contains about twice as many elements as the previous level Finding a match or determ...
68 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1216 | Lượt tải: 0
Four steps to developing a loop from a loop invariant Set initial values for any loop control variables Determine the condition that causes the loop to terminate Modify the control variable so the loop progresses toward termination Check that the invariant remains true at the end of each iteration
56 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1212 | Lượt tải: 0
Recursive Backtracking – process of using recursion to return to earlier decision point If one set of recursive calls does not result in solution, program backs up to previous decision point and makes different decision, often resulting in another set of recursive calls Examples Maze problem Eight-Queens problem
52 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1309 | Lượt tải: 0
JFileChooser – class used to display a dialog that enables users to easily select files Method setFileSelectionMode specifies what user can select from JFileChooser FILES_AND_DIRECTORIES constant indicates files and directories FILES_ONLY constant indicates files only DIRECTORIES_ONLY constant indicates directories only Method showOpenDialog d...
82 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1299 | Lượt tải: 0
Assertions are conditions that should be true at a particular point in a method Help ensure a program’s validity by catching potential bugs Preconditions and Postconditions are two kinds of assertions Assertions can be stated as comments or assertions can be validated programmatically using the assert statement
90 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1145 | Lượt tải: 0
A general path is a shape constructed from straight lines and complex curves Class GeneralPath Method moveTo specifies the first point in a general path Method lineTo draws a line to the next point in the path Method closePath completes the general path Graphics2D method translate – used to move the drawing origin Graphics2D method rotate – u...
74 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1329 | Lượt tải: 0
JScrollPane has scrollbar policies Horizontal policies Always (HORIZONTAL_SCROLLBAR_ALWAYS) As needed (HORIZONTAL_SCROLLBAR_AS_NEEDED) Never (HORIZONTAL_SCROLLBAR_NEVER) Vertical policies Always (VERTICAL_SCROLLBAR_ALWAYS) As needed (VERTICAL_SCROLLBAR_AS_NEEDED) Never (VERTICAL_SCROLLBAR_NEVER)
174 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1204 | Lượt tải: 0
Several UML modeling tools convert UML-based designs into Java code and can speed the implementation process considerably. For more information on these tools, refer to the Internet and Web Resources listed at the end of Section 2.9.
90 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1433 | Lượt tải: 0
Class Object methods clone equals finalize getClass hashCode notify, notifyAll, wait toString
89 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1260 | Lượt tải: 0
Implementing the ATM system from its UML design (for each class) Declare a public class with the name in the first compartment and an empty no-argument constructor Declare instance variables based on attributes in the second compartment Declare references to other objects based on associations described in the class diagram Declare the shells o...
118 trang | Chia sẻ: nguyenlam99 | Ngày: 05/01/2019 | Lượt xem: 1163 | Lượt tải: 0