import java.util.*; // Class definition public class methods { // Scanner class for read user input. static Scanner kb = new Scanner(System.in); // main method. This is where it all starts. public static void main(String[] args) { // Declaraions – variables double x, y, square; // Output statements in the form of method calls to … Read More “new code” »
Author: William Jojo
(Updated November 21, 2024) Table of contents Programming Environment The C Language The C runtime The C Standard(s) Final Thoughts About This Book Quiz Exercises Programming Environment The C programming language makes it easy to develop programs using a simple and modest set of language constructs. The C language is a subset of C++. C++ … Read More “Chapter 1 – The C Environment” »
(Updated January 18, 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” »
(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 January 13, 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” »