Chapter 0 modules¶
- 1. Data Structures and Algorithms
- 2. Spotlight: Carl Friedrich Gauss
- 3. Spotlight: Francis Bacon
- 4. Command Line Basics
- 5. Parsing Command Line Parameters In Your Program
- 6. Using Parameters in Eclipse
- 7. Installing the Web-CAT Submission Plug-in for Eclipse
- 8. Common Debugging Methods
- 9. Debugging In Eclipse
- 10. Reading Input (from Files or Otherwise)
- 11. Random Access Files In Java
- 12. JUnit Testing And You
- 13. Writing JUnit Tests
- 14. Code Coverage In JUnit
- 15. Mutation Coverage In JUnit
- 16. Mutation Testing Examples
- 16.1. Types of Mutants
- 16.1.1. Arithmetic Operation Mutant
- 16.1.2. Example Code 1: Arithmetic Operation Mutant
- 16.1.3. Logical Expression Mutant (Remove Conditionals)
- 16.1.4. Example Code 2: Logical Expression Mutant (Remove Conditionals)
- 16.1.5. Example Code 3: Multiple Mutants in One (EvenOddCheck)
- 16.1.6. Example Code 4: Loop Conditions (optional)
- 16.1. Types of Mutants
- 17. Mutation Coverage: FAQ
- 17.1. Frequently Asked Questions
- 17.1.1. What is Mutation Testing and why should I use it?
- 17.1.2. Does 100% Mutation Score mean 100% Project Correctness?
- 17.1.3. Why does writing Mutation Tests take so much time?
- 17.1.4. Why should I use Mutation Testing instead of Code Coverage?
- 17.1.5. Why are we using this particular set of mutation operators?
- 17.1.6. Does 100% Mutation Score mean my code is perfect?
- 17.1.7. Why do I have bugs in my code despite having 100% Mutation Score?
- 17.1.8. Why do my mutation tests not cover all branches of my code?
- 17.1.9. How do I localize the bugs in my code?
- 17.1.10. How do I recover the “Mutation List”/”Mutation Summary” tabs?
- 17.1. Frequently Asked Questions
- 18. Abstract Data Types
- 19. Introduction to Object Oriented Programming
- 20. The Unified Modeling Language
- 21. Software Development Processes
- 22. Pointers Chapter Introduction
- 23. Basic References Part 1
- 24. Basic References Part 2
- 25. Syntax of the Lambda Calculus
- 26. Local Memory
- 27. Heap Memory
- 28. Link Nodes
- 29. Link Nodes Practice Exercises
- 30. Additional Practice Exercises
- 31. Chapter Introduction
- 32. Sets and Relations
- 33. Miscellaneous Notation
- 34. Logarithms
- 35. Summations
- 36. Recurrence Relations
- 37. Mathematical Proof Techniques
- 38. Estimation
- 39. Chapter Summary Questions
- 40. Searching in an Array
- 41. Chapter Introduction
- 42. Problems, Algorithms, and Programs
- 43. Comparing Algorithms
- 44. Best, Worst, and Average Cases
- 45. Faster Computer, or Faster Algorithm?
- 46. Asymptotic Analysis and Upper Bounds
- 47. Lower Bounds and \(\Theta\) Notation
- 48. Calculating Program Running Time
- 49. Analyzing Problems
- 50. Common Misunderstandings
- 51. Multiple Parameters
- 52. Space Bounds
- 53. Code Tuning and Empirical Analysis
- 54. Algorithm Analysis Summary Exercises
- 55. Algorithm Analysis Summary Exercises
- 56. Chapter Introduction: Lists
- 57. The List ADT
- 58. Array-Based List Implementation
- 59. Linked Lists
- 60. Comparison of List Implementations
- 61. Doubly Linked Lists
- 62. List Element Implementations
- 63. Stacks
- 64. Linked Stacks
- 65. Freelists
- 66. Implementing Recursion
- 67. Queues
- 68. Linked Queues
- 69. Linear Structure Summary Exercises
- 70. Introduction
- 71. Writing a recursive function
- 72. Code Completion Practice Exercises
- 72.1. Introduction
- 72.2. Recursion Programming Exercise: Largest
- 72.3. Recursion Programming Exercise: Multiply
- 72.4. Recursion Programming Exercise: GCD
- 72.5. Recursion Programming Exercise: log
- 72.6. Recursion Programming Exercise: Cummulative Sum
- 72.7. Recursion Programming Exercise: Add odd values
- 72.8. Recursion Programming Exercise: Sum Of the Digits
- 72.9. Recursion Programming Exercise: Count Characters
- 73. Writing More Sophisticated Recursive Functions
- 74. Harder Code Completion Practice Exercises
- 75. Writing Practice Exercises
- 76. Tracing Recursive Code
- 77. Tracing Practice Exercises
- 78. Summary Exercises
- 79. Design Patterns
- 80. Alternative List ADT Designs
- 81. Comparing Records
- 82. The Dictionary ADT
- 83. Binary Trees Chapter Introduction
- 84. Binary Trees
- 85. Binary Tree as a Recursive Data Structure
- 86. The Full Binary Tree Theorem
- 87. Binary Tree Traversals
- 88. Implementing Tree Traversals
- 89. Information Flow in Recursive Functions
- 89.1. Information Flow in Recursive Functions
- 89.2. Binary Tree Set Depth Exercise
- 89.3. Collect-and-return
- 89.4. Binary Tree Check Sum Exercise
- 89.5. Binary Tree Leaf Nodes Count Exercise
- 89.6. Binary Tree Sum Nodes Exercise
- 89.7. Combining Information Flows
- 89.8. Binary Tree Check Value Exercise
- 89.9. Combination Problems
- 89.10. Binary Tree Height Exercise
- 89.11. Binary Tree Get Difference Exercise
- 89.12. Binary Tree Has Path Sum Exercise
- 90. Binary Tree Node Implementations
- 91. Composite-based Expression Tree
- 92. Binary Tree Space Requirements
- 93. Binary Search Trees
- 94. Dictionary Implementation Using a BST
- 95. Binary Tree Guided Information Flow
- 96. Multiple Binary Trees
- 97. A Hard Information Flow Problem
- 98. Array Implementation for Complete Binary Trees
- 99. Heaps and Priority Queues
- 100. Huffman Coding Trees
- 101. Trees versus Tries
- 102. Proof of Optimality for Huffman Coding
- 103. Binary Tree Chapter Summary
- 104. Chapter Introduction: Sorting
- 105. Sorting Terminology and Notation
- 106. Insertion Sort
- 107. Bubble Sort
- 108. Selection Sort
- 109. The Cost of Exchange Sorting
- 110. Optimizing Sort Algorithms with Code Tuning
- 111. Shellsort
- 112. Mergesort Concepts
- 113. Implementing Mergesort
- 114. Quicksort
- 115. Heapsort
- 116. Binsort
- 117. Radix Sort
- 118. An Empirical Comparison of Sorting Algorithms
- 119. Lower Bounds for Sorting
- 120. Sorting Summary Exercises
- 121. Chapter Introduction: File Processing
- 122. Primary versus Secondary Storage
- 123. Disk Drives
- 124. Buffer Pools
- 125. The Programmer’s View of Files
- 126. External Sorting
- 127. Introduction
- 128. Hash Function Principles
- 129. Sample Hash Functions
- 130. Open Hashing
- 131. Bucket Hashing
- 132. Collision Resolution
- 133. Improved Collision Resolution
- 134. Analysis of Closed Hashing
- 135. Deletion
- 136. Hashing Chapter Summary Exercises
- 137. Chapter Introduction: Memory Management
- 138. Dynamic Storage Allocation
- 139. Sequential-Fit Methods
- 140. First Fit
- 141. Circular First Fit
- 142. Best Fit
- 143. Worst Fit
- 144. Sequential Fit Peformance
- 145. Other Memory Allocation Methods
- 146. Failure Policies and Garbage Collection
- 147. Indexing Chapter Introduction
- 148. Linear Indexing
- 149. ISAM
- 150. Tree-based Indexing
- 151. 2-3 Trees
- 152. B-Trees
- 153. Indexing Summary Exercises
- 154. General Trees
- 155. Union/Find and the Parent Pointer Implementation
- 156. Sequential Tree Representations
- 157. Graphs Chapter Introduction
- 158. Graph Implementations
- 159. Graph Traversals
- 160. Topological Sort
- 161. Shortest-Paths Problems
- 162. Minimal Cost Spanning Trees
- 163. Kruskal’s Algorithm
- 164. All-Pairs Shortest Paths
- 165. Spatial Data Structures
- 166. The PR Quadtree
- 167. KD Trees
- 168. The Bintree
- 169. Other Spatial Data Structures
- 170. Data and Algorithm Analysis
- 171. An Introduction to Problem Solving
- 172. Semester Overview
- 173. Introduction to Analyzing a Problem
- 174. Bounds Review
- 175. Growth Rates Review
- 176. Summation Techniques
- 177. Solving Recurrence Relations
- 178. Chapter Introduction: Search
- 179. Analyzing Search in Unsorted Lists
- 180. Search in Sorted Arrays
- 181. Self-Organizing Lists
- 182. Bit Vectors for Representing Sets
- 183. Perfect Hashing
- 184. Finding the Maximum Value
- 185. Adversarial Lower Bounds Proofs
- 186. State Space Lower Bounds Proofs
- 187. Finding the \(i\) th Best Element
- 188. Optimal Sorting
- 189. Number Problems
- 190. The Transformation Concept
- 191. The Fast Fourier Transform
- 192. Introduction to Probabilistic Algorithms
- 193. Finding Prime Numbers
- 194. Random Numbers
- 195. Skip Lists
- 196. Balanced Trees
- 197. The AVL Tree
- 198. The Splay Tree
- 199. The Red-Black Tree
- 200. The Sparse Matrix
- 201. Dynamic Programming
- 202. Amortized Analysis
- 203. 0/1 Knapsack Problem
- 204. Edit Distance
- 205. KMP String Search Algorithm
- 206. Boyer-Moore String Search Algorithm
- 207. Rabin-Karp String Search Algorithm [Draft]
- 208. General Tree Implementations
- 209. K-ary Tree Implementations
- 210. Limits to Computing
- 211. Reductions
- 212. NP-Completeness
- 213. Circuit Satisfiability
- 214. Formula Satisfiability
- 215. 3-CNF Satisfiability
- 216. The Clique Problem
- 217. The Independent Set Problem
- 218. The Vertex Cover Problem
- 219. The Hamiltonian Cycle Problem
- 220. The Traveling Salesman Problem
- 221. NP-Completeness Proofs
- 222. Reduction of Circuit SAT to SAT
- 223. Reduction of SAT to 3-SAT
- 224. Reduction of 3-SAT to Clique
- 225. Reduction of Clique to Independent Set
- 226. Reduction of Independent Set to Vertex Cover
- 227. Reduction of 3-SAT to Hamiltonian Cycle
- 228. Reduction of Hamiltonian Cycle to Traveling Salesman
- 229. Coping with NP-Complete Problems
- 230. Unsolveable Problems
- 231. Turing Machines
- 232. Derivations and Parse Trees
- 233. Ambiguous Grammars
- 234. Enforcing Order of Operations
- 235. Parser Generators
- 236. Using Parser Generators to Interpret a Language
- 237. List Construction and Deconstruction
- 238. Developing Basic, Recursive List-processing Functions
- 239. Recurring On Lists That Aren’t Flat
- 240. Using Helper Functions with Accumulators
- 241. Scope, Closures, Higher-order Functions, Static vs. Dynamic Binding
- 242. Procedural Abstraction: Map, Curry, and Compose
- 243. Procedural Abstraction: The Filtering and Folding (or Reduce) Patterns
- 244. Combining Map and Reduce
- 245. Continuations and Continuation Passing
- 25. Syntax of the Lambda Calculus
- 246. Semantics of the Lambda Calculus
- 247. Free and Bound Variables
- 248. Alpha-Conversion
- 249. The Substitution-Based Model of Evaluation
- 250. Beta-Reduction
- 251. Reduction Strategies
- 252. Church Numerals and Booleans
- 253. Recursive Functions
- 254. Defining SLang 1
- 255. Environment-based Model of Evaluation
- 256. Let Expressions
- 257. Defining SLang 2
- 258. Tying The Knot
- 259. Parameter-Passing Mechanisms
- 260. Lazy Lists
- 261. Types in Programming Languages
- 261.1. Motivating Examples
- 261.2. Type System: Definition
- 261.3. Type System: Static Versus Dynamic
- 261.4. Type System: Safe Versus Unsafe
- 261.5. Type System: Strong Versus Weak
- 261.6. Type System: Typed Variables or Values
- 261.7. Type System: Explicit Versus Implicit typing
- 261.8. The Many Uses of Type Systems
- 262. Type Inference
- 262.1. Type Environments
- 262.2. Typing Rules Expressed as Post Systems
- 262.3. Typing in a Scaled-down ML
- 262.4. Using Post System Rules to Describe Type Inferencing in ML
- 262.5. Parametric Polymorphism in ML
- 262.6. Type inferencing in ML
- 262.7. Type Inferencing Problem 1
- 262.8. Type Inferencing Problem 2
- 262.9. Type Inferencing Problem 3
- 262.10. Type Inferencing Problem 4
- 262.11. Type Inferencing Problem 5
- 262.12. Type Inferencing Problem 6
- 263. GLOSSARY
- 264. Formal Languages
- 265. Overview
- 266. Major Concepts
- 267. Deterministic Finite Acceptors
- 268. Non-Deterministic Finite Automata
- 269. Minimizing the Number of States in a DFA
- 270. Regular Expressions
- 271. Regular Grammars
- 272. Closure Properties of Regular Grammars
- 273. Identifying Non-regular Languages
- 274. Properties
- 275. Context-Free Languages
- 276. Transforming Grammars
- 277. Pushdown Automata
- 278. PDAs and Context Free Languages
- 279. Deterministic Pushdown Automata
- 280. Properties of Context-Free Languages
- 281. Models of Computation
- 231. Turing Machines
- 282. Parsing Introduction
- 283. LL Parsing
- 284. LR Parsing
- 285. CYK Parsing
- 286. Structure of a Compiler
- 287. Recursively Enumerable Languages
- 288. Intro Exercises
- 289. FA Exercises
- 290. Regular Language Exercises
- 291. Sheet 5
- 292. Sheet 6
- 293. Sheet 7
- 294. Intro Exercise Practice
- 295. FA Exercise Practice
- 296. Regular Language Exercise Practice
- 297. Sheet 5 Practice
- 298. List Iteration
- 299. List Iteration Visualizations
- 300. Classwork 8
- 301. Homework 8
- 302. Understanding this Course
- 302.1. Read the Course Syllabus
- 302.2. Who Is This Class For?
- 302.3. Students of Many Experience Levels
- 302.4. Online and Face-to-face Sections
- 302.5. Weekly Schedule
- 302.6. Reading Activities
- 302.7. Labs
- 302.8. Programming Assignments
- 302.9. Programming Language and Environment
- 302.10. Cheating and The Honor Code
- 302.11. Self-Check: Confirm Your Understanding
- 303. Getting Started
- 303.1. Installing BlueJ
- 303.2. Introducing LightBot
- 303.3. From LightBot to Micro Worlds
- 303.4. Self Check: Micro-Worlds
- 303.5. A Bit More LightBot
- 303.6. Textually Representing Programs
- 303.7. Self-Check: Turning Micro-Worlds into Code
- 303.8. What Does LightBot Say About Programming?
- 303.9. A Programmable LightBot in Java
- 303.10. Syntax Practice 1a
- 303.11. Creating New Objects
- 303.12. Calling Methods on an Object
- 303.13. Putting it All Together
- 303.14. A Word on Making Code Easy to Read
- 303.15. Syntax Practice 1b
- 303.16. Programming Practice 1
- 303.17. Check Your Understanding
- 304. Inheritance and Polymorphism: Subclasses and Methods
- 304.1. The Jeroos of Santong Island
- 304.2. Your Opinions on Course Grading Policies
- 304.3. Class Hierarchy and Inheritance
- 304.4. Summarizing: What is Inheritance?
- 304.5. Syntax Practice 2a: Jeroo Methods
- 304.6. Problem Solving and Algorithms
- 304.7. Creating and Using Jeroo Methods
- 304.8. What is Polymorphism?
- 304.9. Syntax Practice 2b: Subclass Constructors
- 304.10. Syntax Practice 2c: More Subclass Constructors
- 304.11. Programming Practice 2
- 304.12. Check Your Understanding
- 305. Conditional and Repeating Actions
- 305.1. Selection
- 305.2. Conditions Using Sensor Methods
- 305.3. An Overview of Conditional Statements
- 305.4. Java’s Syntax for the If-Then-Else Structure
- 305.5. Syntax Practice 3a: If-Then-Else
- 305.6. Creating Optional Statements With If-then
- 305.7. Java’s Syntax for the If-then Structure
- 305.8. Syntax Practice 3b: If-Then
- 305.9. Java’s Syntax for the Multi-way Selection Structure (a cascaded if)
- 305.10. Syntax Practice 3c: Multi-way If
- 305.11. Compound Conditions
- 305.12. Syntax Practice 3d: Compound Conditions
- 305.13. Repeating Actions
- 305.14. Generic Repetition Structures
- 305.15. Java’s Syntax for the While Loop
- 305.16. Syntax Practice 3e: While Loops
- 305.17. Programming Practice 3
- 305.18. Check Your Understanding
- 306. Software Testing
- 306.1. What Is Software Testing?
- 306.2. Writing Your First Software Test
- 306.3. Check Your Understanding: Software Testing Concepts
- 306.4. More About Methods
- 306.5. Check Your Understanding: Method Signatures
- 306.6. Check Your Understanding: Methods with Parameters
- 306.7. Good Habits for Conditionals
- 306.8. A Different Type of Complex If-Statement
- 306.9. Short Circuit Evaluation
- 306.10. Check Your Understanding: Logical Equivalence
- 306.11. Syntax Practice 4a: Compound Conditionals
- 306.12. Syntax Practice 4b: Conditionals and Relational Operators
- 306.13. Programming Practice 4
- 306.14. Module Review
- 307. Variables, Fields, and Parameters
- 307.1. Variables
- 307.2. Check Your Understanding: Variables
- 307.3. Fields Versus Local Variables
- 307.4. Changing Private Variables: Mutator Methods
- 307.5. Check your Understanding: Scope
- 307.6. Accessor Methods
- 307.7. Check Your Understanding: Fields, Getters and Setters
- 307.8. Syntax Practice 5a: Fields and Accessors
- 307.9. The Return Keyword
- 307.10. Check your Understanding: Typed Methods and Return Statements
- 307.11. Syntax Practice 5b: Mutators and Return Statements
- 307.12. Using Fields in Testing
- 307.13. Programming Practice 5a
- 307.14. Programming Practice 5b
- 308. Pictures and For-each Loops
- 309. Aggregation, Strings and More Loops
- 309.1. Object-Oriented Design: Aggregation, Composition, and Delegation
- 309.2. Strings and Characters
- 309.3. Check Your Understanding: Strings
- 309.4. Counter-controlled Loops
- 309.5. Check Your Understanding: Counter Controlled Loops
- 309.6. Tips on Random Numbers
- 309.7. Check Your Understanding: Random Numbers
- 309.8. Method Overriding
- 309.9. Check Your Understanding: Method Overriding
- 309.10. Syntax Practice 7a: For Loops and OO Design
- 309.11. Syntax Practice 7b: toString and Returning Values
- 309.12. Programming Practice 7a
- 309.13. Programming Practice 7b
- 310. Grouping Objects Using Lists and Nested For Loops
- 310.1. Collections of Objects
- 310.2. Interfaces
- 310.3. Check Your Understanding: Interfaces
- 310.4. Syntax Practice 8a: Strings
- 310.5. The List Interface
- 310.6. Generics
- 310.7. ArrayList
- 310.8. Check Your Understanding: ArrayLists
- 310.9. Syntax Practice 8b: Lists
- 310.10. Nested For Loops
- 310.11. Check Your Understanding: Nested For Loops
- 310.12. Syntax Practice 8c: Nested Loops
- 310.13. Check Your Understanding
- 310.14. Programming Practice 8a
- 310.15. Programming Practice 8b
- 311. Lists, Loop Idioms, Generics, and the Null Keyword
- 311.1. Modelling the Contents of a Library
- 311.2. Looping Idioms
- 311.3. Check Your Understanding: Loop Idioms
- 311.4. Syntax Practice 9a: Loop Idioms
- 311.5. Generics Revisited
- 311.6. Check Your Understanding: Generics
- 311.7. Syntax Practice 9b: Generics
- 311.8. The Null Keyword
- 311.9. Diagnosing a Null Pointer Exception
- 311.10. Check Your Understanding: Null
- 311.11. Using BlueJ’s Debugger
- 311.12. Using BlueJ’s Code Pad
- 311.13. Programming Practice 9a: Loop Idioms
- 311.14. Programming Practice 9b: Loops and Generics
- 312. Arrays
- 312.1. Creating An Array
- 312.2. Accessing Items in Arrays
- 312.3. Setting Items in an Array
- 312.4. Arrays Compared to Lists (or ArrayList)
- 312.5. Putting It All Together
- 312.6. Check Your Understanding: Arrays
- 312.7. Syntax Practice 10a
- 312.8. Iterating Over Arrays
- 312.9. Check Your Understanding: Iterating with Arrays
- 312.10. Syntax Practice 10b
- 312.11. Initializing Array Contents
- 312.12. Printing Arrays
- 312.13. Copying Array Variables
- 312.14. Naming Array Variables
- 312.15. Writing Test Assertions Involving Arrays
- 312.16. Applying Arrays in a Problem
- 312.17. Syntax Practice 10c
- 312.18. Check Your Understanding
- 312.19. Programming Practice 10a
- 312.20. Programming Practice 10b
- 313. Multi-dimensional Arrays
- 313.1. Dimensions in an Array
- 313.2. Check Your Understanding: 2D Arrays
- 313.3. Syntax Practice: 2D Array Basics
- 313.4. Iterating through a 2D Array
- 313.5. Check Your Understanding: Iterating with 2D Arrays
- 313.6. Syntax Practice: Looping Over 2D Arrays
- 313.7. Multi-Dimensional Arrays
- 313.8. Syntax Practice: 3D Arrays
- 313.9. But Can You Have Multi-dimensional Lists?
- 313.10. Integer Division and Modulus
- 313.11. Check Your Understanding: Modulus
- 313.12. Syntax Practice: Modulus
- 313.13. Programming Practice: Multi-dimensional Arrays
- 313.14. Programming Practice: Mod
- 314. Variable Scoping, Input, and Output
- 314.1. Variable Scoping
- 314.2. Summarizing Scope Concepts
- 314.3. Check Your Understanding: Scope
- 314.4. Syntax Practice: Scoping
- 314.5. Java Input and Output
- 314.6. Output Using PrintWriters
- 314.7. Check Your Understanding: Output
- 314.8. Input Using Scanners
- 314.9. A Complete Input Example
- 314.10. Check Your Understanding: Input
- 314.11. A Complete Input/Output Example
- 314.12. Testing I/O-based Operations
- 314.13. Check Your Understanding: Testing
- 315. Maps and Sets
- 315.1. The Map and Set Interfaces
- 315.2. The Map Interface
- 315.3. Syntax Practice: Making Maps
- 315.4. Adding and Accessing Pairs in a Map
- 315.5. Syntax Practice: Adding to Maps
- 315.6. Checking for and Removing Pairs in a Map
- 315.7. A Visual Summary of Using Map and HashMap
- 315.8. Syntax Practice: Map Contains and Remove
- 315.9. Looping Over Map Contents
- 315.10. Check Your Understanding: Maps
- 315.11. The Set Interface
- 315.12. Syntax Practice: Making A Set
- 315.13. Adding Values to a Set
- 315.14. Syntax Practice: Adding to a Set
- 315.15. Checking Values in a Set
- 315.16. Syntax Practice: Set Contains
- 315.17. Removing Values from a Set
- 315.18. Syntax Practice: Set Remove
- 315.19. Looping Over Sets
- 315.20. Check Your Understanding: Sets
- 315.21. Programming Practice: Maps
- 316. Static, Main, and Exceptions
- 316.1. The Main Method
- 316.2. Check Your Understanding: Main Methods
- 316.3. The Static Keyword
- 316.4. Check Your Understanding: The Static Keyword
- 316.5. Your Opinions on Course Grading Policies
- 316.6. Errors
- 316.7. Throwing Exceptions
- 316.8. Check Your Understanding: Throwing Exceptions
- 316.9. Syntax Practice: Throwing Exceptions
- 316.10. Try/Catch Blocks
- 316.11. Check Your Understanding: Try/Catch Blocks
- 316.12. Syntax Practice: Try-Catch Blocks