(Updated May 8, 2025) Table of contents Overview Basic Tree Red-Black Trees AVL Tree B-Tree Special-Purpose Tree Exercises Overview The tree data structure provides a means of implementing sorted data in the form of a modified linked list such that traversals are far less expensive and approach O(log2n). We say they approach because the tree … Read More “Chapter 18 – Trees” »
Author: William Jojo
(Updated January 16, 2025) Table of contents Overview The Cloneable Interface The Comparable Interface Generic Methods Generic Classes Generic Data Structures Exercises Overview Much of the code we have dealt with up to this point has been geared toward a specific data type. For example, a particular method or class is often centered around strings … Read More “Chapter 17 – Generic Methods and Classes” »
(Updated January 14, 2025) Table of contents Overview Stacks Queues Deques (Double-Ended Queues) Exercises Overview This section expands linked lists. Remember that each data structure shown here is still a linked list. What changes are the rules governing how the object may be manipulated. Stacks Overview Stacks are a wondrous structure. This is mainly because … Read More “Chapter 16 – Stack, Queues and Deques” »
(Updated January 14, 2025) Table of contents Overview Hashing Hash Table Hash Function Implementation Collision Resolution Load Factor Hash Map Improving Hashes Complete Examples Exercises Overview We have seen arrays and their power. They can store vast knowledge, perform complex operations like sorting, and be relatively fast using tools like binary search. The next step … Read More “Chapter 15 – Hashing” »
(Updated March 27, 2025) Table of contents Overview The Linked List Building the LinkedList Class Iterators An IterableList Implementing remove() An Alternative Node Approach Exercises Overview We discovered the usefulness of collecting data together under a single identifier name when using arrays. Further, we enjoyed the simplicity of accessing the elements of the array with … Read More “Chapter 14 – Linked Lists, Iterators” »
(Updated January 13, 2025) Table of contents Overview The Basics An Example Different Types of Recursion Another Example The Cost Memoization Exercises Overview We have previously determined that we often need to work while some condition exists or until some condition is met. This has always been handled using an iterative process, which we call … Read More “Chapter 13 – Recursion” »
(Updated January 12, 2025) Table of contents Overview Handling Exceptions The try/catch/finally Block The Exception Hierarchy Checked and Unchecked Exceptions Creating an Exception Class Exercises Overview When we develop a Java program, there are many opportunities to fix syntax and logic problems. Some possibilities are available through error messages from the compiler, which refuses to … Read More “Chapter 12 – Exceptions” »
Updated January 13, 2025 Table of contents Inheritance The Object Class Abstract Methods and Classes Interfaces Inheritance vs. Composition Exercises Inheritance Recall from our discussion on creating a GUI that we chose to use the phrase extends Application (for JavaFX). This meant the class containing our program could obtain the ability to display a window … Read More “Chapter 11 – Inheritance and Polymorphism” »
(Updated January 12, 2025) Table of contents Overview Autoboxing and Auto-Unboxing The Vector Class The ArrayList Class Enumerations Color Vector Part II The instanceof Operator Quiz Exercises Overview The use of arrays has opened up many possibilities for collecting related data together. This is just the beginning of collecting data of varying forms into containers … Read More “Chapter 10 – Vector, ArrayList and Enumerations” »
(Updated May 5, 2025) Table of contents Overview Mean, Median and Mode Sorting Bubble Sort Selection Sort Insertion Sort Shell Sort Quick Sort Sort Stress Test Searching Linear (Sequential) Search Binary Search Exercises Overview Once we have data in arrays, we quickly realize the value of having it in one place and easily addressable and … Read More “Chapter 9S – Sorting and Searching” »