Data structures and algorithms in Java 2nd Edition
Adam Drozdek Updated 2025
https://ebookfinal.com/download/data-structures-and-algorithms-in-
java-2nd-edition-adam-drozdek/
★★★★★
4.9 out of 5.0 (58 reviews )
Instant PDF Download
ebookfinal.com
Data structures and algorithms in Java 2nd Edition Adam
Drozdek Pdf Download
EBOOK
Available Formats
■ PDF eBook Study Guide Ebook
EXCLUSIVE 2025 EDUCATIONAL COLLECTION - LIMITED TIME
INSTANT DOWNLOAD VIEW LIBRARY
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.
Data Structures in Java A Laboratory Course 1st Edition
Sandra Andersen
https://ebookfinal.com/download/data-structures-in-java-a-laboratory-
course-1st-edition-sandra-andersen/
Data Structures and Algorithm Analysis in Java 3rd Edition
Edition Mark A. Weiss
https://ebookfinal.com/download/data-structures-and-algorithm-
analysis-in-java-3rd-edition-edition-mark-a-weiss/
Data Structures and Algorithm Analysis in Java 3rd Edition
Dr. Clifford A. Shaffer
https://ebookfinal.com/download/data-structures-and-algorithm-
analysis-in-java-3rd-edition-dr-clifford-a-shaffer/
Problem Solving in Data Structures Algorithms Using Python
Programming Interview Guide 1st Edition Hemant Jain
https://ebookfinal.com/download/problem-solving-in-data-structures-
algorithms-using-python-programming-interview-guide-1st-edition-
hemant-jain/
Fundamentals of Data Structures in C 2nd Edition Ellis
Horowitz
https://ebookfinal.com/download/fundamentals-of-data-structures-
in-c-2nd-edition-ellis-horowitz/
Algorithms and Data Structures The Science of Computing
Electrical and Computer Engineering Series 1st Edition
Douglas Baldwin
https://ebookfinal.com/download/algorithms-and-data-structures-the-
science-of-computing-electrical-and-computer-engineering-series-1st-
edition-douglas-baldwin/
Data Structures and Algorithm Analysis in C 2nd Edition
China Reprint Edition Weiss
https://ebookfinal.com/download/data-structures-and-algorithm-
analysis-in-c-2nd-edition-china-reprint-edition-weiss/
Algorithms and Theory of Computation Handbook Second
Edition Volume 1 General Concepts and Techniques Chapman
Hall CRC Applied Algorithms and Data Structures series
Mikhail J. Atallah
https://ebookfinal.com/download/algorithms-and-theory-of-computation-
handbook-second-edition-volume-1-general-concepts-and-techniques-
chapman-hall-crc-applied-algorithms-and-data-structures-series-
mikhail-j-atallah/
Algorithms and Theory of Computation Handbook Second
Edition Volume 2 Special Topics and Techniques Chapman
Hall CRC Applied Algorithms and Data Structures series
Mikhail J. Atallah
https://ebookfinal.com/download/algorithms-and-theory-of-computation-
handbook-second-edition-volume-2-special-topics-and-techniques-
chapman-hall-crc-applied-algorithms-and-data-structures-series-
mikhail-j-atallah/
Data structures and algorithms in Java 2nd Edition Adam
Drozdek Digital Instant Download
Author(s): Adam Drozdek
ISBN(s): 9780534492526, 0534492525
Edition: 2
File Details: PDF, 3.77 MB
Year: 2005
Language: english
Data Structures
and Algorithms
in Java
SECOND EDITION
Adam Drozdek
Australia • Canada • Mexico • Singapore • Spain • United Kingdom • United States
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Data Structures
and Algorithms
in Java
SECOND EDITION
Adam Drozdek
Australia • Canada • Mexico • Singapore • Spain • United Kingdom • United States
Data Structures
and Algorithms
in Java
SECOND EDITION
Adam Drozdek
Australia • Canada • Mexico • Singapore • Spain • United Kingdom • United States
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Data Structures and Algorithms in Java, Second Edition
by Adam Drozdek
Senior Acquisitions Editor: Amy Yarnevich Production Editor: Jennifer Harvey
Product Manager: Alyssa Pratt Associate Product Manager: Mirella Misiaszek
Editorial Assistant: Amanda Piantedosi Cover Design: Joel Sadagursky
Senior Marketing Manager: Karen Sietz Compositor: Pre-Press Company, Inc.
COPYRIGHT © 2005 Course Technology, a division of Thomson Learning, Inc.
Thomson Learning™ is a trademark used herein under license.
Printed in the United States of America
1 2 3 4 5 6 7 8 9 BM 06 05 04 03 02
For more information, contact Course Technology,
25 Thomson Place, Boston, Massachusetts, 02210.
Or find us on the World Wide Web at: www.course.com
ALL RIGHTS RESERVED. No part of this work covered by the copyright hereon
may be reproduced or used in any form or by any means—graphic, electronic,
or mechanical, including photocopying, recording, taping, Web distribution, or
information storage and retrieval systems—without the written permission of
the publisher.
For permission to use material from this text or product, contact us by
Tel (800) 730-2214
Fax (800) 730-2215
www.thomsonrights.com
Disclaimer
Course Technology reserves the right to revise this publication and make changes
from time to time in its content without notice.
ISBN 0-534-49252-5
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
TO MY WIFE , BOGNA
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Contents
1 O BJECT-O RIENTED P ROGRAMMING U SING JAVA 1
1.1 Rudimentary Java 1
1.1.1 Variable Declarations 1
1.1.2 Operators 4
1.1.3 Decision Statements 5
1.1.4 Loops 6
1.1.5 Exception Handling 6
1.2 Object-Oriented Programming in Java 8
1.2.1 Encapsulation 8
1.2.2 Abstract Data Types 16
1.2.3 Inheritance 18
1.2.4 Polymorphism 21
1.3 Input and Output 24
1.3.1 Reading and Writing Bytes 26
1.3.2 Reading Lines 27
1.3.3 Reading Tokens: Words and Numbers 28
1.3.4 Reading and Writing Primitive Data Types 29
1.3.5 Reading and Writing Objects 29
1.3.6 Random Access File 30
1.4 Java and Pointers 31
1.5 Vectors in java.util 35
1.6 Data Structures and Object-Oriented Programming 42
1.7 Case Study: Random Access File 42
1.8 Exercises 51
1.9 Programming Assignments 53
Bibliography 55
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
vi ■ Contents
2 C OMPLEXITY A NALYSIS 56
2.1 Computational and Asymptotic Complexity 56
2.2 Big-O Notation 57
2.3 Properties of Big-O Notation 59
2.4 Ω and Q Notations 61
2.5 Possible Problems 62
2.6 Examples of Complexities 62
2.7 Finding Asymptotic Complexity: Examples 64
2.8 The Best, Average, and Worst Cases 66
2.9 Amortized Complexity 69
2.10 NP-Completeness 73
2.11 Exercises 76
Bibliography 79
3 L INKED L ISTS 80
3.1 Singly Linked Lists 80
3.1.1 Insertion 86
3.1.2 Deletion 88
3.1.3 Search 93
3.2 Doubly Linked Lists 95
3.3 Circular Lists 99
3.4 Skip Lists 101
3.5 Self-Organizing Lists 107
3.6 Sparse Tables 111
3.7 Lists in java.util 114
3.7.1 LinkedList 114
3.7.2 ArrayList 120
3.8 Concluding Remarks 123
3.9 Case Study: A Library 124
3.10 Exercises 134
3.11 Programming Assignments 136
Bibliography 139
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Contents ■ vii
4 S TACKS AND Q UEUES 140
4.1 Stacks 140
4.1.1 Stacks in java.util 148
4.2 Queues 149
4.3 Priority Queues 157
4.4 Case Study: Exiting a Maze 158
4.5 Exercises 164
4.6 Programming Assignments 166
Bibliography 168
5 R ECURSION 169
5.1 Recursive Definitions 169
5.2 Method Calls and Recursion Implementation 172
5.3 Anatomy of a Recursive Call 174
5.4 Tail Recursion 178
5.5 Nontail Recursion 179
5.6 Indirect Recursion 185
5.7 Nested Recursion 187
5.8 Excessive Recursion 188
5.9 Backtracking 191
5.10 Concluding Remarks 198
5.11 Case Study: A Recursive Descent Interpreter 199
5.12 Exercises 207
5.13 Programming Assignments 210
Bibliography 212
6 B INARY T REES 214
6.1 Trees, Binary Trees, and Binary Search Trees 214
6.2 Implementing Binary Trees 219
6.3 Searching a Binary Search Tree 221
6.4 Tree Traversal 223
6.4.1 Breadth-First Traversal 224
6.4.2 Depth-First Traversal 225
6.4.3 Stackless Depth-First Traversal 231
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
viii ■ Contents
6.5 Insertion 239
6.6 Deletion 242
6.6.1 Deletion by Merging 243
6.6.2 Deletion by Copying 246
6.7 Balancing a Tree 249
6.7.1 The DSW Algorithm 252
6.7.2 AVL Trees 255
6.8 Self-Adjusting Trees 260
6.8.1 Self-Restructuring Trees 261
6.8.2 Splaying 262
6.9 Heaps 267
6.9.1 Heaps as Priority Queues 269
6.9.2 Organizing Arrays as Heaps 272
6.10 Polish Notation and Expression Trees 275
6.10.1 Operations on Expression Trees 277
6.11 Case Study: Computing Word Frequencies 280
6.12 Exercises 289
6.13 Programming Assignments 292
Bibliography 296
7 M ULTIWAY T REES 299
7.1 The Family of B-Trees 300
7.1.1 B-Trees 301
7.1.2 B*-Trees 312
7.1.3 B+-Trees 313
7.1.4 Prefix B+-Trees 316
7.1.5 Bit-Trees 319
7.1.6 R-Trees 320
7.1.7 2–4 Trees 323
7.1.8 Trees in java.util 338
7.2 Tries 349
7.3 Concluding Remarks 358
7.4 Case Study: Spell Checker 358
7.5 Exercises 369
7.6 Programming Assignments 370
Bibliography 374
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Contents ■ ix
8 G RAPHS 376
8.1 Graph Representation 377
8.2 Graph Traversals 379
8.3 Shortest Paths 383
8.3.1 All-to-All Shortest Path Problem 390
8.4 Cycle Detection 392
8.4.1 Union-Find Problem 393
8.5 Spanning Trees 395
8.6 Connectivity 399
8.6.1 Connectivity in Undirected Graphs 399
8.6.2 Connectivity in Directed Graphs 402
8.7 Topological Sort 405
8.8 Networks 407
8.8.1 Maximum Flows 407
8.8.2 Maximum Flows of Minimum Cost 417
8.9 Matching 421
8.9.1 Stable Matching Problem 426
8.9.2 Assignment Problem 428
8.9.3 Matching in Nonbipartite Graphs 430
8.10 Eulerian and Hamiltonian Graphs 432
8.10.1 Eulerian Graphs 432
8.10.2 Hamiltonian Graphs 436
8.11 Graph Coloring 442
8.12 NP-Complete Problems in Graph Theory 445
8.12.1 The Clique Problem 445
8.12.2 The 3-Colorability Problem 446
8.12.3 The Vertex Cover Problem 448
8.12.4 The Hamiltonian Cycle Problem 449
8.13 Case Study: Distinct Representatives 450
8.14 Exercises 460
8.15 Programming Assignments 464
Bibliography 466
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
x ■ Contents
9 S ORTING 469
9.1 Elementary Sorting Algorithms 470
9.1.1 Insertion Sort 470
9.1.2 Selection Sort 474
9.1.3 Bubble Sort 475
9.2 Decision Trees 477
9.3 Efficient Sorting Algorithms 481
9.3.1 Shell Sort 481
9.3.2 Heap Sort 484
9.3.3 Quicksort 488
9.3.4 Mergesort 494
9.3.5 Radix Sort 497
9.4 Sorting in java.util 502
9.5 Concluding Remarks 505
9.6 Case Study: Adding Polynomials 507
9.7 Exercises 515
9.8 Programming Assignments 516
Bibliography 517
10 H ASHING 519
10.1 Hash Functions 520
10.1.1 Division 520
10.1.2 Folding 520
10.1.3 Mid-Square Function 521
10.1.4 Extraction 521
10.1.5 Radix Transformation 522
10.2 Collision Resolution 522
10.2.1 Open Addressing 522
10.2.2 Chaining 528
10.2.3 Bucket Addressing 530
10.3 Deletion 531
10.4 Perfect Hash Functions 532
10.4.1 Cichelli’s Method 533
10.4.2 The FHCD Algorithm 536
10.5 Hash Functions for Extendible Files 538
10.5.1 Extendible Hashing 539
10.5.2 Linear Hashing 541
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Contents ■ xi
10.6 Hashing in java.util 544
10.6.1 HashMap 544
10.6.2 HashSet 547
10.6.3 HashTable 552
10.7 Case Study: Hashing with Buckets 557
10.8 Exercises 566
10.9 Programming Assignments 567
Bibliography 568
11 DATA C OMPRESSION 570
11.1 Conditions for Data Compression 570
11.2 Huffman Coding 572
11.2.1 Adaptive Huffman Coding 581
11.3 Run-Length Encoding 586
11.4 Ziv-Lempel Code 587
11.5 Case Study: Huffman Method with Run-Length Encoding 590
11.6 Exercises 601
11.7 Programming Assignments 601
Bibliography 603
12 M EMORY M ANAGEMENT 604
12.1 The Sequential-Fit Methods 605
12.2 The Nonsequential-Fit Methods 606
12.2.1 Buddy Systems 608
12.3 Garbage Collection 615
12.3.1 Mark-and-Sweep 616
12.3.2 Copying Methods 623
12.3.3 Incremental Garbage Collection 625
12.4 Concluding Remarks 633
12.5 Case Study: An In-Place Garbage Collector 634
12.6 Exercises 643
12.7 Programming Assignments 644
Bibliography 647
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
xii ■ Contents
13 S TRING M ATCHING 649
13.1 Exact String Matching 649
13.1.1 Straightforward Algorithms 649
13.1.2 The Knuth-Morris-Pratt Algorithm 652
13.1.3 The Boyer-Moore Algorithm 660
13.1.4 Multiple Searches 670
13.1.5 Bit-Oriented Approach 672
13.1.6 Matching Sets of Words 676
13.1.7 Regular Expression Matching 682
13.1.8 Suffix Tries and Trees 686
13.1.9 Suffix Arrays 693
13.2 Approximate String Matching 694
13.2.1 String Similarity 695
13.2.2 String Matching with k Errors 701
13.3 Case Study: Longest Common Substring 704
13.4 Exercises 713
13.5 Programming Assignments 715
Bibliography 716
A PPENDIXES
A Computing Big-O 718
A.1 Harmonic Series 718
A.2 Approximation of the Function lg(n!) 718
A.3 Big-O for Average Case of Quicksort 720
A.4 Average Path Length in a Random Binary Tree 722
A.5 The Number of Nodes in an AVL Tree 723
B NP-Completeness 724
B.1 Cook’s Theorem 724
Name Index 737
Subject Index 740
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Preface
The study of data structures, a fundamental component of a computer science educa-
tion, serves as the foundation upon which many other computer science fields are
built. Some knowledge of data structures is a must for students who wish to do work
in design, implementation, testing, or maintenance of virtually any software system.
The scope and presentation of material in Data Structures and Algorithms in Java pro-
vide students with the knowledge necessary to perform such work.
This book highlights three important aspects of data structures. First, a very
strong emphasis is placed on the connection between data structures and their algo-
rithms, including analyzing algorithms’ complexity. Second, data structures are pre-
sented in an object-oriented setting in accordance with the current design and
implementation paradigm. In particular, the information-hiding principle to advance
encapsulation and decomposition is stressed. Finally, an important component of the
book is data structure implementation, which leads to the choice of Java as the pro-
gramming language.
The Java language, an object-oriented descendant of C and C++, has gained pop-
ularity in industry and academia as an excellent programming language due to wide-
spread use of the Internet. Because of its consistent use of object-oriented features
and the security of the language, Java is also useful and natural for introducing data
structures. Currently, C++ is the primary language of choice for teaching data struc-
tures; however, because of the wide use of Java in application programming and the
object-oriented characteristics of the language, using Java to teach a data structures
and algorithms course, even on the introductory level, is well justified.
This book provides the material for a course that includes the topics listed under
CS2 and CS7 of the old ACM curriculum. It also meets the requirements for most of
the courses CA 202, CD 202, and CF 204 of the new ACM curriculum.
Most chapters include a case study that illustrates a complete context in which
certain algorithms and data structures can be used. These case studies were chosen
from different areas of computer science such as interpreters, symbolic computation,
and file processing, to indicate the wide range of applications to which topics under
discussion may apply.
xiii
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
xiv ■ Preface
Brief examples of Java code are included throughout the book to illustrate the
practical importance of data structures. However, theoretical analysis is equally im-
portant. Thus, presentations of algorithms are integrated with analyses of efficiency.
Great care is taken in the presentation of recursion because even advanced students
have problems with it. Experience has shown that recursion can be explained best if the
run-time stack is taken into consideration. Changes to the stack are shown when tracing
a recursive function not only in the chapter on recursion, but also in other chapters. For
example, a surprisingly short method for tree traversal may remain a mystery if work
done by the system on the run-time stack is not included in the explanation. Standing
aloof from the system and retaining only a purely theoretical perspective when dis-
cussing data structures and algorithms are not necessarily helpful. This book also in-
cludes comprehensive chapters on data compression and memory management.
The thrust of this book is data structures, and other topics are treated here only as
much as necessary to ensure a proper understanding of this subject. Algorithms are
discussed from the perspective of data structures, so the reader will not find a com-
prehensive discussion of different kinds of algorithms and all the facets that a full
presentation of algorithms requires. However, as mentioned, recursion is covered in
depth. In addition, complexity analysis of algorithms is presented in some detail.
Chapters 1 and 3–8 present a number of different data structures and the algo-
rithms that operate on them. The efficiency of each algorithm is analyzed, and improve-
ments to the algorithm are suggested.
■ Chapter 1 presents the basic principles of object-oriented programming, an intro-
duction to dynamic memory allocation and the use of pointers, and a rudimentary
introduction to Java.
■ Chapter 2 describes some methods used to assess the efficiency of algorithms.
■ Chapter 3 contains an introduction to linked lists.
■ Chapter 4 presents stacks and queues and their applications.
■ Chapter 5 contains a detailed discussion of recursion. Different types of recursion are
discussed, and a recursive call is dissected.
■ Chapter 6 discusses binary trees, including implementation, traversal, and search.
This chapter also includes balanced trees.
■ Chapter 7 details more generalized trees such as tries, 2– 4 trees, and B-trees.
■ Chapter 8 presents graphs.
Chapters 9–12 show different applications of data structures introduced in the
previous chapters. They emphasize the data structure aspects of each topic under
consideration.
■ Chapter 9 analyzes sorting in detail, and several elementary and nonelementary
methods are presented.
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Preface ■ xv
■ Chapter 10 discusses hashing, one of the most important areas in searching. Various
techniques are presented with an emphasis on the utilization of data structures.
■ Chapter 11 discusses data compression algorithms and data structures.
■ Chapter 12 presents various techniques and data structures for memory
management.
■ Chapter 13 discusses many algorithms for exact and approximate string matching.
■ Appendix A discusses in greater detail big-O notation, introduced in Chapter 2.
■ Appendix B gives a proof of Cook’s theorem and illustrates it with an extended
example.
Each chapter contains a discussion of the material illustrated with appropriate
diagrams and tables. Except for Chapter 2, all chapters include a case study, which is
an extended example using the features discussed in that chapter. All case studies have
been tested using the Visual C++ compiler on a PC and the g++ compiler under
UNIX except the von Koch snowflake, which runs on a PC under Visual C++. At the
end of each chapter is a set of exercises of varying degrees of difficulty. Except for
Chapter 2, all chapters also include programming assignments and an up-to-date bib-
liography of relevant literature.
Chapters 1–6 (excluding Sections 2.9, 3.4, 6.4.3, 6.7, and 6.8) contain the core
material that forms the basis of any data structures course. These chapters should be
studied in sequence. The remaining six chapters can be read in any order. A one-
semester course could include Chapters 1–6, 9, and Sections 10.1 and 10.2. The entire
book could also be part of a two-semester sequence.
TEACHING TOOLS
Electronic Instructor’s Manual. The Instructor’s Manual that accompanies this text-
book includes complete solutions to all text exercises.
Electronic Figure Files. All images from the text are available in bitmap format for use
in classroom presentations.
Source Code. The source code for the text example programs is available via the au-
thor’s Web site at http://www.mathes.dug.edu/drozdek/DSinJava.
It is also available for student download at course.com. All teaching tools, outlined
above, are available in the Instructor’s Resources section of course.com.
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
xvi ■ Preface
CHANGES IN THE SECOND EDITION
The new edition primarily extends the old edition by including material on new topics
that are currently not covered. The additions include
■ Pattern matching algorithms in the new Chapter 13
■ A discussion of NP-completeness in the form of a general introduction (Section 2.10),
examples of NP-complete problems (Section 8.12), and an outline of Cook’s theorem
(Appendix B)
■ New material on graphs (Sections 8.9.1, 8.10.1.1, 8.10.2.1, and 8.11)
■ A discussion of a deletion algorithm for vh-trees (Section 7.1.7)
■ An introduction to Java files (Sections 1.3.1–1.3.6)
Moreover, the tables that list methods from java.util packages have been updated.
There are also many small modifications and additions throughout the book.
ACKNOWLEDGMENTS
I would like to thank the following reviewers, whose comments and advice helped me
to improve this book:
James Ball, Indiana State University
Robin Dawes, Queen’s University
Julius Dichter, University of Bridgeport
However, the ultimate content is my responsibility, and I would appreciate
hearing from readers about any shortcomings or strengths. My email address is
[email protected].
Adam Drozdek
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Object-Oriented
Programming
Using Java
1
T
his chapter introduces the reader to elementary Java. Java is an immense lan-
guage and programming environment, and it is impossible to touch upon all
Java-related issues within the confines of one chapter. This chapter introduces
only those aspects of Java that are necessary for understanding the Java code offered in
this book. The reader familiar with Java can skip this chapter.
1.1 RUDIMENTARY JAVA
A Java program is a sequence of statements that have to be formed in accordance with
the predefined syntax. A statement is the smallest executable unit in Java. Each state-
ment ends with a semicolon. Compound statements, or blocks, are marked by delim-
iting them with braces, { and }.
1.1.1 Variable Declarations
Each variable must be declared before it can be used in a program. It is declared by
specifying its type and its name. Variable names are strings of any length of letters,
digits, underscores, and dollar signs that begin with a letter, underscore, or dollar sign.
However, a letter is any Unicode letter (a character above 192), not just 1 of the 26 let-
ters in the English alphabet. Local variables must be initialized. Java is case sensitive,
so variable n is different from variable N.
A type of variable is either one of the eight built-in basic types, a built-in or user-
defined class type, or an array. Here are built-in types and their sizes:
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
2 ■ Chapter 1 Object-Oriented Programming Using Java
Type Size Range
boolean 1 bit true, false
char 16 bits Unicode characters
byte 8 bits [-128, 127]
short 16 bits [-32768, 32767]
int 32 bits [-2147483648, 2147483647]
long 64 bits [-9223372036854775808, 9223372036854775807]
float 32 bits [-3.4E38, 3.4E38]
double 64 bits [-1.7E308, 1.7E308]
Note that the sizes of the types are fixed, which is extremely important for portabil-
ity of programs. In C/C++, the size of integers and long integers is system depen-
dent. Unlike C/C++, boolean is not a numeric type, and no arithmetic operations
can be performed on boolean variables. But as in C/C++, characters are consid-
ered integers (in Java, they are unsigned integers) so that they can be operands of
arithmetic operations.
Integer operations are performed with 32-bit precision (for long integers, it is 64-
bit precision); therefore, operations on byte and short variables require a cast. For
example, the statements
byte a, b = 1, c = 2;
a = b + c;
give a compilation error, “incompatible type for =. Explicit cast is needed to convert
int to byte.” The addition b + c gives an integer value that must be cast to execute
the assignment to the byte variable a. To avoid the problem, the assignment should
be changed to
a = (byte) (b + c);
An overflow resulting from an arithmetic operation (unless it is division by zero)
is not indicated, so the programmer must be aware that, for two integers,
int i = 2147483647, j = i + 1;
the value of j is –2147483648.
Java does not provide modifiers signed and unsigned, but it has other modifiers.
An important difference between C/C++ and Java is characters that are 8 bits
long in C/C++ and 16 bits long in Java. With the usual 8-bit characters, only 256 dif-
ferent characters can be represented. To address the problem of representing charac-
ters of languages other than English, the set of available codes must be significantly
extended. The problem is not only with representing letters with diacritical marks
(e.g., Polish letter ń, Romanian letter ţ, or Danish letter ø), but also with non-Latin
characters such as Cyrillic, Greek, Japanese, Chinese, and so on. By allowing a charac-
ter variable to be of 2 bytes, the number of different characters represented now
equals 65,536.
Copyright 2010 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part.
Exploring the Variety of Random
Documents with Different Content
Politics - Cheat Sheet
Spring 2024 - School
Prepared by: Researcher Smith
Date: August 12, 2025
Topic 1: Theoretical framework and methodology
Learning Objective 1: Study tips and learning strategies
• Theoretical framework and methodology
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Learning Objective 2: Experimental procedures and results
• Fundamental concepts and principles
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Learning Objective 3: Critical analysis and evaluation
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Learning Objective 4: Problem-solving strategies and techniques
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 4: Diagram/Chart/Graph]
Learning Objective 5: Historical development and evolution
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
[Figure 5: Diagram/Chart/Graph]
Note: Historical development and evolution
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
[Figure 6: Diagram/Chart/Graph]
Practice Problem 6: Case studies and real-world applications
• Experimental procedures and results
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Important: Learning outcomes and objectives
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
[Figure 8: Diagram/Chart/Graph]
Definition: Comparative analysis and synthesis
• Statistical analysis and interpretation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Practice Problem 9: Fundamental concepts and principles
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Background 2: Comparative analysis and synthesis
Definition: Historical development and evolution
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 11: Assessment criteria and rubrics
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Key Concept: Historical development and evolution
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Interdisciplinary approaches
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Definition: Learning outcomes and objectives
• Study tips and learning strategies
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Practice Problem 15: Practical applications and examples
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Key Concept: Current trends and future directions
• Critical analysis and evaluation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Study tips and learning strategies
• Literature review and discussion
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 18: Learning outcomes and objectives
• Assessment criteria and rubrics
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Experimental procedures and results
• Key terms and definitions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Topic 3: Ethical considerations and implications
Important: Case studies and real-world applications
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Note: Interdisciplinary approaches
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Key Concept: Assessment criteria and rubrics
• Assessment criteria and rubrics
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 23: Diagram/Chart/Graph]
Note: Statistical analysis and interpretation
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Important: Experimental procedures and results
• Ethical considerations and implications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Practical applications and examples
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Remember: Fundamental concepts and principles
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 27: Best practices and recommendations
• Fundamental concepts and principles
- Sub-point: Additional details and explanations
- Example: Practical application scenario
[Figure 28: Diagram/Chart/Graph]
Remember: Case studies and real-world applications
• Theoretical framework and methodology
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Key Concept: Historical development and evolution
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Unit 4: Experimental procedures and results
Important: Practical applications and examples
• Assessment criteria and rubrics
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Practical applications and examples
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Fundamental concepts and principles
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 33: Critical analysis and evaluation
• Study tips and learning strategies
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Critical analysis and evaluation
• Critical analysis and evaluation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 35: Diagram/Chart/Graph]
Definition: Learning outcomes and objectives
• Statistical analysis and interpretation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 36: Diagram/Chart/Graph]
Example 36: Case studies and real-world applications
• Research findings and conclusions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
[Figure 37: Diagram/Chart/Graph]
Remember: Interdisciplinary approaches
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Theoretical framework and methodology
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Practice Problem 39: Statistical analysis and interpretation
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
[Figure 40: Diagram/Chart/Graph]
Practice 5: Literature review and discussion
Practice Problem 40: Assessment criteria and rubrics
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Remember: Best practices and recommendations
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Practical applications and examples
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 43: Assessment criteria and rubrics
• Research findings and conclusions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Experimental procedures and results
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Key Concept: Best practices and recommendations
• Statistical analysis and interpretation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 46: Statistical analysis and interpretation
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 47: Diagram/Chart/Graph]
Key Concept: Best practices and recommendations
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Example 48: Critical analysis and evaluation
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
Key Concept: Assessment criteria and rubrics
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
References 6: Historical development and evolution
Definition: Theoretical framework and methodology
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 51: Assessment criteria and rubrics
• Experimental procedures and results
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Practice Problem 52: Assessment criteria and rubrics
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Practice Problem 53: Case studies and real-world applications
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Key Concept: Theoretical framework and methodology
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Key terms and definitions
• Assessment criteria and rubrics
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Study tips and learning strategies
• Critical analysis and evaluation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 57: Study tips and learning strategies
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 58: Best practices and recommendations
• Experimental procedures and results
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Critical analysis and evaluation
• Study tips and learning strategies
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
[Figure 60: Diagram/Chart/Graph]
References 7: Practical applications and examples
Note: Case studies and real-world applications
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 61: Diagram/Chart/Graph]
Definition: Ethical considerations and implications
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Practice Problem 62: Historical development and evolution
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 63: Statistical analysis and interpretation
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Comparative analysis and synthesis
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
[Figure 65: Diagram/Chart/Graph]
Example 65: Study tips and learning strategies
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Definition: Key terms and definitions
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 67: Experimental procedures and results
• Study tips and learning strategies
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Historical development and evolution
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Definition: Fundamental concepts and principles
• Current trends and future directions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Module 8: Current trends and future directions
Practice Problem 70: Statistical analysis and interpretation
• Practical applications and examples
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
Note: Fundamental concepts and principles
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Critical analysis and evaluation
• Key terms and definitions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Key terms and definitions
• Ethical considerations and implications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Literature review and discussion
• Ethical considerations and implications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Note: Case studies and real-world applications
• Fundamental concepts and principles
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Important: Problem-solving strategies and techniques
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Definition: Statistical analysis and interpretation
• Research findings and conclusions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
Remember: Critical analysis and evaluation
• Study tips and learning strategies
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Remember: Interdisciplinary approaches
• Comparative analysis and synthesis
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 80: Diagram/Chart/Graph]
Abstract 9: Assessment criteria and rubrics
Practice Problem 80: Problem-solving strategies and techniques
• Experimental procedures and results
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Key Concept: Ethical considerations and implications
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 82: Learning outcomes and objectives
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Important: Practical applications and examples
• Assessment criteria and rubrics
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Fundamental concepts and principles
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Case studies and real-world applications
• Experimental procedures and results
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Key Concept: Assessment criteria and rubrics
• Ethical considerations and implications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 87: Diagram/Chart/Graph]
Note: Best practices and recommendations
• Critical analysis and evaluation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
[Figure 88: Diagram/Chart/Graph]
Practice Problem 88: Assessment criteria and rubrics
• Current trends and future directions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Remember: Research findings and conclusions
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
[Figure 90: Diagram/Chart/Graph]
Results 10: Interdisciplinary approaches
Key Concept: Literature review and discussion
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Note: Key terms and definitions
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 92: Diagram/Chart/Graph]
Example 92: Best practices and recommendations
• Statistical analysis and interpretation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Example 93: Research findings and conclusions
• Interdisciplinary approaches
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
[Figure 94: Diagram/Chart/Graph]
Key Concept: Study tips and learning strategies
• Research findings and conclusions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Best practices and recommendations
• Theoretical framework and methodology
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Example 96: Case studies and real-world applications
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Remember: Literature review and discussion
• Case studies and real-world applications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Remember: Ethical considerations and implications
• Fundamental concepts and principles
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Important: Historical development and evolution
• Literature review and discussion
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
References 11: Historical development and evolution
Remember: Study tips and learning strategies
• Ethical considerations and implications
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Important: Historical development and evolution
• Theoretical framework and methodology
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Practice Problem 102: Current trends and future directions
• Learning outcomes and objectives
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Note: Best practices and recommendations
• Current trends and future directions
- Sub-point: Additional details and explanations
- Example: Practical application scenario
Formula: [Mathematical expression or equation]
Example 104: Critical analysis and evaluation
• Fundamental concepts and principles
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Key Concept: Practical applications and examples
• Best practices and recommendations
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Definition: Research findings and conclusions
• Problem-solving strategies and techniques
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Example 107: Assessment criteria and rubrics
• Statistical analysis and interpretation
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Definition: Comparative analysis and synthesis
• Historical development and evolution
- Sub-point: Additional details and explanations
- Example: Practical application scenario
- Note: Important consideration
Formula: [Mathematical expression or equation]
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com