A Practical Introduction to Data Structures and Algorithm by Clifford A. Shaffer

By Clifford A. Shaffer

Show description

Read or Download A Practical Introduction to Data Structures and Algorithm Analysis Third Edition (Java Version) PDF

Best programming: programming languages books

Extra resources for A Practical Introduction to Data Structures and Algorithm Analysis Third Edition (Java Version)

Example text

Sec. 4 17 Problems, Algorithms, and Programs Programmers commonly deal with problems, algorithms, and computer programs. These are three distinct concepts. Problems: As your intuition would suggest, a problem is a task to be performed. It is best thought of in terms of inputs and matching outputs. A problem definition should not include any constraints on how the problem is to be solved. The solution method should be developed only after the problem is precisely defined and thoroughly understood.

Does every problem have an algorithm? Does every algorithm have a Java program? Consider the design for a spelling checker program meant to run on a home computer. The spelling checker should be able to handle quickly a document of less than twenty pages. Assume that the spelling checker comes with a dictionary of about 20,000 words. What primitive operations must be implemented on the dictionary, and what is a reasonable time constraint for each operation? Sec. 2. Suggest two possible implementations for the database.

Random(i)); // swap A[i-1] with } // a random element Boolean variables: A Boolean variable is a variable (of type boolean in Java) that takes on one of the two values true and false. These two values are often associated with the values 1 and 0, respectively, although there is no reason why this needs to be the case. It is poor programming practice to rely on the correspondence between 0 and false, because these are logically distinct objects of different types. Floor and ceiling: The floor of x (written x ) takes real value x and returns the greatest integer ≤ x.

Download PDF sample

Rated 4.81 of 5 – based on 26 votes