Home Page Icon
Home Page
Table of Contents for
Beginning Java Data Structures and Algorithms
Close
Beginning Java Data Structures and Algorithms
by James Cutajar
Beginning Java Data Structures and Algorithms
Title Page
Copyright and Credits
Beginning Java Data Structures and Algorithms
Packt Upsell
Why Subscribe?
PacktPub.com
Contributors
About the Author
Packt Is Searching for Authors like You
Preface
Who This Book Is For
What This Book Covers
To Get the Most out of This Book
Download the Example Code Files
Download the Color Images
Conventions Used
Get in Touch
Reviews
Algorithms and Complexities
Developing Our First Algorithm
Algorithm for Converting Binary Numbers to Decimal
Activity: Writing an Algorithm to Convert Numbers from Octal To Decimal
Measuring Algorithmic Complexity with Big O Notation
Complexity Example
Understanding Complexity
Activity: Developing a Timing Table Using the Exponential Algorithm
Complexity Notation
Identifying the Best and Worst Performance of an Algorithm While Checking for Duplicates in an Array
Activity: Converting Expressions to Big O Notations
Identifying Algorithms with Different Complexities
Linear Complexity
Quadratic Complexity
Logarithmic Complexity
Exponential Complexity
Constant Complexity
Activity: Developing a Faster Intersection Algorithm
Summary
Sorting Algorithms and Fundamental Data Structures
Introducing Bubble Sorting
Understanding Bubble Sorting
Implementing Bubble Sort
Improving Bubble Sorting
Implementing Bubble Sort Improvement
Activity: Implementing Selection Sort in Java
Understanding Quick Sort
Understanding Recursion
Implementing Binary Search Recursively
Quicksort Partitioning
Activity: Understanding the Partitioning Method
Putting It All Together
Implementing Quick Sort
Using Merge Sort
Dividing the Problem
Implementing Merge Sort
Merging the Problem
Activity: Implementing Merge Sort in Java
Getting Started with Fundamental Data Structures
Introducing Data Structures
Linked Lists Structure
Converting the Linked List to a Doubly Linked List Structure 
Linked Lists Operations
Activity: Traversing the Linked List
Queues
Adding and Deleting the Elements from the Queue
Stacks
Reversing a String
Modeling Stacks and Queues Using Arrays
Safe Enqueuing in an Array
Activity: Evaluating the Postfix Expression
Summary
Hash Tables and Binary Search Trees
Introducing Hash Tables
Understanding Hash Tables
Dealing with Collisions with Chaining
Dealing with Collisions with Open Addressing
Carrying out the Linear Probing Search Operation
Remainder and Multiplication Hash Functions
Implementing the Multiplication Method for a Hash Table
Universal Hashing
Activity: Implementing Open Addressing
Getting Started with Binary Search Trees
Binary Tree Structure
Binary Search Tree Operations
Searching for a Minimum Key in a Binary Tree
Traversing a Binary Search Tree
Activity: Implementing BFS in Java
Balanced Binary Search Trees
Applying Right Tree Rotation
Activity: Retrieving the Successor of an Element When the Tree is Traversed in Inorder
Summary
Algorithm Design Paradigms
Introducing Greedy Algorithms
The Activity Selection Problem
Solving the Activity Selection Problem
Ingredients of a Greedy Algorithm
Optimal Substructure Property
Greedy Choice Property
Huffman Coding
Building a Huffman Code
Developing an Algorithm to Generate Code Words Using Huffman Coding
Activity: Implementing a Greedy Algorithm to Compute Egyptian Fractions
Getting Started with Divide and Conquer Algorithms
The Divide and Conquer Approach
The Master Method
The Closest Pair of Points Problem
Activity: Solving the Maximum Subarray Problem
Understanding Dynamic Programming
Elements of a Dynamic Programming Problem
Optimal Substructure
Overlapping Subproblems
0-1 Knapsack
Solving the 0-1 Knapsack Problem Using Recursion
Longest Common Subsequence
Activity: The Coin Change Problem
Summary
String Matching Algorithms
Naive Search Algorithm
Implementing Naive Search
Developing the String Matching Algorithm in Java
Rationalization of the Naive Search Algorithm
Getting Started with the Boyer-Moore String Searching Algorithm
The Bad Character Rule
Activity: Implementing the Bad Character Rule
The Good Suffix Rule
Application of the Boyer-Moore Algorithm
Implementing the Boyer-Moore Algorithm 
Introducing Other String Matching Algorithms
Rabin-Karp
Applying the Rabin-Karp Algorithm
Knuth–Morris–Pratt
Aho–Corasick
Summary
Graphs, Prime Numbers, and Complexity Classes
Representing Graphs
Adjacency List Representation
Writing a Java Code to Add Weights to the Directed Graph
Adjacency Matrix Representation
Activity: Building the Adjacency Matrix Representation of a Weighted Undirected Graph
Traversing a Graph
Breadth-First Search
Depth-First Search
Cycle Detection
Activity: Using BFS to Find the Shortest Path Out of a Maze
Calculating Shortest Paths
Single Source Shortest Path: Dijkstra's Algorithm
All Pairs Shortest Paths: Floyd-Warshall Algorithm
Activity: Improving Floyd-Warshall's Algorithm to Reconstruct the Shortest Path
Prime Numbers in Algorithms
Sieve of Eratosthenes
Prime Factorization
Activity: Implementing the Sieve of Eratosthenes
Other Concepts in Graphs
Minimum Spanning Trees
A* Search
Maximum Flow
Understanding Complexity Classes of Problems
Summary
Other Books You May Enjoy
Leave a Review - Let Other Readers Know What You Think
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Next
Next Chapter
Title Page
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset