(Updated September 4, 2024) 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 September 4, 2024) 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 September 3, 2024) 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 is changing are the rules that govern how the object may be manipulated. Stacks Overview Stacks are a wondrous structure. This is … Read More “Chapter 16 – Stack, Queues and Deques” »
(Updated September 2, 2024) 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 amounts of knowledge, perform complex operations like sorting, and be relatively fast using tools like binary search. The … Read More “Chapter 15 – Hashing” »
(Updated September 2, 2024) Table of contents Overview The Linked List Building the LinkedList Class Iterators An IterableList Implementing remove() An Alternative Node Approach Exercises Overview When using arrays, we discovered the usefulness of collecting data together under a single identifier name. Further, we enjoyed the simplicity of accessing the elements of the array with … Read More “Chapter 14 – Linked Lists, Iterators” »
(Updated September 2, 2024) 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 September 2, 2024) 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 September 1, 2024 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 JFrame (for Swing) or extends Application (for JavaFX). This meant the class containing our program could obtain the … Read More “Chapter 11 – Inheritance and Polymorphism” »
(Updated September 1, 2024) Table of contents Overview Wrapper Classes – Revisited 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 … Read More “Chapter 10 – Vector, ArrayList and Enumerations” »
(Updated December 29, 2022) The idea behind interactive fiction (IF) is to create a world in which the player is captivated by the need to use their imagination to determine the next step to winning the game. IF does not use graphics, it is entirely text-based, and the player is encouraged to take notes and … Read More “JPbD Interactive Fiction Interlude 1” »