Data Structures and Abstractions with Java

Similar documents
DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

CLASSIC DATA STRUCTURES IN JAVA

Data Structures and Abstractions with Java

CS 445: Data Structures Final Examination: Study Guide

DATA STRUCTURES AND PROBLEM SOLVING USING JAVA

Data Structures in C++ Using the Standard Template Library

PROBLEM SOLVING USING JAVA WITH DATA STRUCTURES. A Multimedia Approach. Mark Guzdial and Barbara Ericson PEARSON. College of Computing

AP Computer Science 4325

Prelude to Programming

Building Java Programs

Objects First with Java

Contributor. International Edition contributions by. Piyali Sengupta PEARSON. New York San Francisco Upper

Programming. In Ada JOHN BARNES TT ADDISON-WESLEY

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis

ony Gaddis Haywood Community College STARTING OUT WITH PEARSON Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto

Visual C# Tony Gaddis. Haywood Community College STARTING OUT WITH. Piyali Sengupta. Third Edition. Global Edition contributions by.

Anany Levitin 3RD EDITION. Arup Kumar Bhattacharjee. mmmmm Analysis of Algorithms. Soumen Mukherjee. Introduction to TllG DCSISFI &

Table of Contents. Chapter 1: Introduction to Data Structures... 1

Total No. of Questions :09] [Total No. of Pages : 02. II/IV B.Tech. DEGREE EXAMINATIONS, NOV/DEC First Semester CSE/IT DATA STRUCTURES USING C

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

This page intentionally left blank

Absolute C++ Walter Savitch

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned.

Introduction to Programming Using Java (98-388)

CS301 - Data Structures Glossary By

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

CS302 Data Structures using C++

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

CJT^jL rafting Cm ompiler

Programming in Python 3

Data Structures and Algorithm Analysis in C++

WITH C+ + William Ford University of the Pacific. William Topp University of the Pacific. Prentice Hall, Englewood Cliffs, New Jersey 07632

OBJECT ORIENTED DATA STRUCTURE & ALGORITHMS

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

Essentials of Database Management

Course Review for Finals. Cpt S 223 Fall 2008

Course Review. Cpt S 223 Fall 2009

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Supplement I.A: Glossary For Introduction to Programming and Data Structures with C++ Fourth Edition By Y. Daniel Liang

World Wide Web PROGRAMMING THE PEARSON EIGHTH EDITION. University of Colorado at Colorado Springs

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Problem Solving with C++

Object-Oriented Programming and Data Structures

182 review 1. Course Goals

Core Java Syllabus. Overview

CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014

About this exam review

5/23/2015. Core Java Syllabus. VikRam ShaRma

What s New in the Second Edition

JAVA CONCEPTS Early Objects

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

Database Concepts. David M. Kroenke UNIVERSITATSBIBLIOTHEK HANNOVER

Algorithms and Data Structures Spring 2008

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Chapter 1 Introduction

Summer Final Exam Review Session August 5, 2009

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

Samples of Evidence to Satisfy the AP Computer Science AB Curricular Requirements

CS2013 Course Syllabus Spring 2017 Lecture: Friday 8:00 A.M. 9:40 A.M. Lab: Friday 9:40 A.M. 12:00 Noon

INSTITUTE OF AERONAUTICAL ENGINEERING

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

DATA STRUCTURES THROUGH C++

MyProgram m i ng Lab. get with the programming. Through the power of practice and immediate personalized

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

This page intentionally left blank

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

Topics for CSCI 151 Final Exam Wednesday, May 10

Systems:;-'./'--'.; r. Ramez Elmasri Department of Computer Science and Engineering The University of Texas at Arlington

Course Review. Cpt S 223 Fall 2010


Real-Time Systems and Programming Languages

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 CS205: DATA STRUCTURES (CS, IT)

Java Fundamentals p. 1 The Origins of Java p. 2 How Java Relates to C and C++ p. 3 How Java Relates to C# p. 4 Java's Contribution to the Internet p.

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

Java 2. Course Outcome Summary. Western Technical College. Course Information. Course History. Course Competencies

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance

DOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

Supplement I.A: Glossary. For Introduction to C++ Programming, Third Edition By Y. Daniel Liang

EXAMINATIONS 2016 TRIMESTER 2

Big Java Late Objects

Supplement I.A: Glossary. For Introduction to C++ Programming, Second Edition By Y. Daniel Liang

Contents Chapter 1 Introduction to Programming and the Java Language

Course Description. Learn To: : Intro to JAVA SE7 and Programming using JAVA SE7. Course Outline ::

CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

Question Paper Code : 97044

12 Abstract Data Types

Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.

School of Computing and Information Sciences. Course Title: Data Structures Date: 3/30/2010 Course Number: COP 3530 Number of Credits: 3

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

DATA STRUCTURES AND ALGORITHMS

^l^s^^^^^^^^^^s^^^ ^.1^L^ gs *^gs (s^s^^^^s^^ ^S^^^^ls

QUESTION BANK. Prepared by,mrs.d.maladhy AP/IT,RGCET. Page 1

Transcription:

Global edition Data Structures and Abstractions with Java Fourth edition Frank M. Carrano Timothy M. Henry

Data Structures and Abstractions with Java TM Fourth Edition Global Edition Frank M. Carrano University of Rhode Island Timothy M. Henry New England Institute of Technology Global Edition contributions by Mohit P. Tahiliani National Institute of Technology Karnataka Boston Columbus Indianpolis New York San Francisco Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montréal Toronto Delhi Mexico City São Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo

Data Structures and Abstractions with Java, Global Edition Table of Contents Cover Title Page Copyright Contents Introduction: Organizing Data Prelude: Designing Classes Encapsulation Specifying Methods Comments Preconditions and Postconditions Assertions Java Interfaces Writing an Interface Implementing an Interface An Interface as a Data Type Extending an Interface Named Constants Within an Interface Choosing Classes Identifying Classes CRC Cards The Unified Modeling Language Reusing Classes Chapter 1: Bags The Bag A Bags Behaviors Specifying a Bag An Interface Using the ADT Bag Using an ADT Is Like Using a Vending Machine The ADT Set Java Class Library: The Interface set Java Interlude 1: Generics Generic Data Types Generic Types Within an Interface Generic Classes

Chapter 2: Bag Implementations That Use Arrays Using a Fixed-Size Array to Implement the ADT Bag An Analogy A Group of Core Methods Implementing the Core Methods Making the Implementation Secure Testing the Core Methods Implementing More Methods Methods That Remove Entries Using Array Resizing to Implement the ADT Bag Resizing an Array A New Implementation of a Bag The Pros and Cons of Using an Array to Implement the ADT Bag Java Interlude 2: Exceptions The Basics Handling an Exception Postpone Handling: The throws Clause Handle It Now: The try-catch Blocks Multiple catch Blocks Throwing an Exception Chapter 3: A Bag Implementation That Links Data Linked Data Forming a Chain by Adding to Its Beginning A Linked Implementation of the ADT Bag The Private Class Node An Outline of the Class LinkedBag Defining Some Core Methods Testing the Core Methods The Method getfrequencyof The Method contains Removing an Item from a Linked Chain The Methods remove and clear A Class Node That Has Set and Get Methods The Pros and Cons of Using a Chain to Implement the ADT Bag Chapter 4: The Efficiency of Algorithms Motivation Measuring an Algorithms Efficiency Counting Basic Operations Best, Worst, and Average Cases Big Oh Notation The Complexities of Program Constructs Picturing Efficiency The Efficiency of Implementations of the ADT Bag

An Array-Based Implementation A Linked Implementation Comparing the Implementations Chapter 5: Stacks Specifications of the ADT Stack Using a Stack to Process Algebraic Expressions A Problem Solved: Checking for Balanced Delimiters in an Infix Algebraic Expression A Problem Solved: Transforming an Infix Expression to a Postfix Expression A Problem Solved: Evaluating Postfix Expressions A Problem Solved: Evaluating Infix Expressions The Program Stack Java Class Library: The Class Stack Chapter 6: Stack Implementations A Linked Implementation An Array-Based Implementation A Vector-Based Implementation Java Class Library: The Class Vector Using a Vector to Implement the ADT Stack Chapter 7: Recursion What Is Recursion? Tracing a Recursive Method Recursive Methods That Return a Value Recursively Processing an Array Recursively Processing a Linked Chain The Time Efficiency of Recursive Methods The Time Efficiency of countdown The Time Efficiency of Computing xn A Simple Solution to a Difficult Problem A Poor Solution to a Simple Problem Tail Recursion Indirect Recursion Using a Stack Instead of Recursion Java Interlude 3: More About Generics The Interface Comparable Generic Methods Bounded Type Parameters Wildcards Bounded Wildcards Chapter 8: An Introduction to Sorting Organizing Java Methods That Sort an Array Selection Sort

Iterative Selection Sort Recursive Selection Sort The Efficiency of Selection Sort Insertion Sort Iterative Insertion Sort Recursive Insertion Sort The Efficiency of Insertion Sort Insertion Sort of a Chain of Linked Nodes Shell Sort The Algorithm The Efficiency of Shell Sort Comparing the Algorithms Chapter 9: Faster Sorting Methods Merge Sort Merging Arrays Recursive Merge Sort The Efficiency of Merge Sort Iterative Merge Sort Merge Sort in the Java Class Library Quick Sort The Efficiency of Quick Sort Creating the Partition Implementing Quick Sort Quick Sort in the Java Class Library Radix Sort Pseudocode for Radix Sort The Efficiency of Radix Sort Comparing the Algorithms Java Interlude 4: More About Exceptions Programmer-Defined Exception Classes Inheritance and Exceptions The finally Block Chapter 10: Queues, Deques, and Priority Queues The ADT Queue A Problem Solved: Simulating a Waiting Line A Problem Solved: Computing the Capital Gain in a Sale of Stock Java Class Library: The Interface Queue The ADT Deque A Problem Solved: Computing the Capital Gain in a Sale of Stock Java Class Library: The Interface Deque Java Class Library: The Class ArrayDeque The ADT Priority Queue A Problem Solved: Tracking Your Assignments Java Class Library: The Class PriorityQueue

Chapter 11: Queue, Deque, and Priority Queue Implementations A Linked Implementation of a Queue An Array-Based Implementation of a Queue A Circular Array A Circular Array with One Unused Location Circular Linked Implementations of a Queue A Two-Part Circular Linked Chain Java Class Library: The Class AbstractQueue A Doubly Linked Implementation of a Deque Possible Implementations of a Priority Queue Chapter 12: Lists Specifications for the ADT List Using the ADT List Java Class Library: The Interface List Java Class Library: The Class ArrayList Chapter 13: A List Implementation That Uses an Array Using an Array to Implement the ADT List An Analogy The Java Implementation The Efficiency of Using an Array to Implement the ADT List Chapter 14: A List Implementation That Links Data Operations on a Chain of Linked Nodes Adding a Node at Various Positions Removing a Node from Various Positions The Private Method getnodeat Beginning the Implementation The Data Fields and Constructor Adding to the End of the List Adding at a Given Position Within the List The Methods isempty and toarray Testing the Core Methods Continuing the Implementation A Refined Implementation The Tail Reference The Efficiency of Using a Chain to Implement the ADT List Java Class Library: The Class LinkedList Java Interlude 5: Iterators What Is an Iterator? The Interface Iterator The Interface Iterable Using the Interface Iterator Iterable and for-each Loops The Interface ListIterator

The Interface List Revisited Using the Interface ListIterator Chapter 15: Iterators for the ADT List Ways to Implement an Iterator A Separate Class Iterator An Inner Class Iterator A Linked Implementation An Array-Based Implementation Why Are Iterator Methods in Their Own Class? An Array-Based Implementation of the Interface ListIterator The Inner Class Java Interlude 6: Mutable and Immutable Objects Mutable Objects Immutable Objects Creating a Read-Only Class Companion Classes Chapter 16: Sorted Lists Specifications for the ADT Sorted List Using the ADT Sorted List A Linked Implementation The Method add The Efficiency of the Linked Implementation An Implementation That Uses the ADT List Efficiency Issues Java Interlude 7: Inheritance and Polymorphism Further Aspects of Inheritance When to Use Inheritance Protected Access Abstract Classes and Methods Interfaces Versus Abstract Classes Polymorphism Chapter 17: Inheritance and Lists Using Inheritance to Implement a Sorted List Designing a Base Class Creating an Abstract Base Class An Efficient Implementation of a Sorted List The Method add Chapter 18: Searching The Problem Searching an Unsorted Array An Iterative Sequential Search of an Unsorted Array A Recursive Sequential Search of an Unsorted Array

The Efficiency of a Sequential Search of an Array Searching a Sorted Array A Sequential Search of a Sorted Array A Binary Search of a Sorted Array Java Class Library: The Method binarysearch The Efficiency of a Binary Search of an Array Searching an Unsorted Chain An Iterative Sequential Search of an Unsorted Chain A Recursive Sequential Search of an Unsorted Chain The Efficiency of a Sequential Search of a Chain Searching a Sorted Chain A Sequential Search of a Sorted Chain A Binary Search of a Sorted Chain Choosing a Search Method Java Interlude 8: Generics Once Again More Than One Generic Type Chapter 19: Dictionaries Specifications for the ADT Dictionary A Java Interface Iterators Using the ADT Dictionary A Problem Solved: A Directory of Telephone Numbers A Problem Solved: The Frequency of Words A Problem Solved: A Concordance of Words Java Class Library: The Interface Map Chapter 20: Dictionary Implementations Array-Based Implementations An Unsorted Array-Based Dictionary A Sorted Array-Based Dictionary Linked Implementations An Unsorted Linked Dictionary A Sorted Linked Dictionary Chapter 21: Introducing Hashing What Is Hashing? Hash Functions Computing Hash Codes Compressing a Hash Code into an Index for the Hash Table Resolving Collisions Open Addressing with Linear Probing Open Addressing with Quadratic Probing Open Addressing with Double Hashing A Potential Problem with Open Addressing Separate Chaining Chapter 22: Hashing as a Dictionary Implementation

The Efficiency of Hashing The Load Factor The Cost of Open Addressing The Cost of Separate Chaining Rehashing Comparing Schemes for Collision Resolution A Dictionary Implementation That Uses Hashing Entries in the Hash Table Data Fields and Constructors The Methods getvalue, remove, and add Iterators Java Class Library: The Class HashMap Jave Class Library: The Class HashSet Chapter 23: Trees Tree Concepts Hierarchical Organizations Tree Terminology Traversals of a Tree Traversals of a Binary Tree Traversals of a General Tree Java Interfaces for Trees Interfaces for All Trees An Interface for Binary Trees Examples of Binary Trees Expression Trees Decision Trees Binary Search Trees Heaps Examples of General Trees Parse Trees Game Trees Chapter 24: Tree Implementations The Nodes in a Binary Tree A Class of Binary Nodes An Implementation of the ADT Binary Tree Creating a Basic Binary Tree The Method privatesettree Accessor and Mutator Methods Computing the Height and Counting Nodes Traversals An Implementation of an Expression Tree General Trees A Node for a General Tree Using a Binary Tree to Represent a General Tree Java Interlude 9: Cloning

Cloneable Objects Cloning an Array Cloning a Chain A Sorted List of Clones Cloning a Binary Node Chapter 25: A Binary Search Tree Implementation Getting Started An Interface for the Binary Search Tree Duplicate Entries Beginning the Class Definition Searching and Retrieving Traversing Adding an Entry A Recursive Implementation An Iterative Implementation Removing an Entry Removing an Entry Whose Node Is a Leaf Removing an Entry Whose Node Has One Child Removing an Entry Whose Node Has Two Children Removing an Entry in the Root A Recursive Implementation An Iterative Implementation The Efficiency of Operations The Importance of Balance The Order in Which Nodes Are Added An Implementation of the ADT Dictionary Chapter 26: A Heap Implementation Reprise: The ADT Heap Using an Array to Represent a Heap Adding an Entry Removing the Root Creating a Heap Heap Sort Chapter 27: Balanced Search Trees AVL Trees Single Rotations Double Rotations Implementation Details 2-3 Trees Searching a 2-3 Tree Adding Entries to a 2-3 Tree Splitting Nodes During Addition 2-4 Trees Adding Entries to a 2-4 Tree

Comparing AVL, 2-3, and 2-4 Trees Red-Black Trees Properties of a Red-Black Tree Adding Entries to a Red-Black Tree Java Class Library: The Class TreeMap B-Trees Chapter 28: Graphs Some Examples and Terminology Road Maps Airline Routes Mazes Course Prerequisites Trees Traversals Breadth-First Traversal Depth-First Traversal Topological Order Paths Finding a Path The Shortest Path in an Unweighted Graph The Shortest Path in a Weighted Graph Java Interfaces for the ADT Graph Chapter 29: Graph Implementations An Overview of Two Implementations The Adjacency Matrix The Adjacency List Vertices and Edges Specifying the Class Vertex The Inner Class Edge Implementing the Class Vertex An Implementation of the ADT Graph Basic Operations Graph Algorithms Appendix A: Documentation and Programming Style Naming Variables and Classes Indenting Comments Single-Line Comments Comment Blocks When to Write Comments Java Documentation Comments Appendix B: Java Basics (online) Introduction

Applications and Applets Objects and Classes A First Java Application Program Elements of Java Identifiers Reserved Words Variables Primitive Types Constants Assignment Statements Assignment Compatibilities Type Casting Arithmetic Operators and Expressions Parentheses and Precedence Rules Increment and Decrement Operators Special Assignment Operators Named Constants The Class Math Simple Input and Output Using the Keyboard and Screen Screen Output Keyboard Input Using the Class Scanner The if-else Statement Boolean Expressions Nested Statements Multiway if-else Statements The Conditional Operator (Optional) The switch Statement Enumerations Scope Loops The while Statement The for Statement The do-while Statement Additional Loop Information The Class String Characters Within Strings Concatenation of Strings String Methods The Class StringBuilder Using Scanner to Extract Pieces of a String Arrays

Array Parameters and Returned Values Initializing Arrays Array Index Out of Bounds Use of = and == with Arrays Arrays and the For-Each Loop Multidimensional Arrays Wrapper Classes Appendix C: Java Classes (online) Objects and Classes Using the Methods in a Java Class References and Aliases Defining a Java Class Method Definitions Arguments and Parameters Passing Arguments A Definition of the Class Name Constructors The Method tostring Methods That Call Other Methods Methods That Return an Instance of Their Class Static Fields and Methods Overloading Methods Enumeration as a Class Packages The Java Class Library Appendix D: Creating Classes from Other Classes Composition Adapters Inheritance Invoking Constructors from Within Constructors Private Fields and Methods of the Superclass Overriding and Overloading Methods Multiple Inheritance Type Compatibility and Superclasses The Class Object Appendix E: File Input and Output (online) Preliminaries Why Files? Streams The Kinds of Files

File Names Text Files Creating a Text File Reading a Text File Changing Existing Data in a Text File Defining a Method to Open a Stream Binary Files Creating a Binary File of Primitive Data Reading a Binary File of Primitive Data Strings in a Binary File Object Serialization Glossary (online) Index A B C D E F G H I J K L M N O P Q R S T U V W