Contents [0/1] |
Homework (MyRecursion, Union Find Problems) [1/1] |
(Click here for one slide per page)
Homework (MyRecursion, Union Find Problems) [1/1] |
Read Recursion Call Stacks. This will give you an iea of how recursion is implemented in Java - using our friend the Stack data structure!
The discussion in this document refers to a Java file: MyRecursionTrace.java. You can download this file and save it in a new package called ds1.student.recursion
in your IntelliJ IDEA project.
Optional: Do the exercises in this document. (You don't need to hand them in.)
Read Algorithms Section 1.5 - Case Study: Union-Find
Do Quiz 9 on Recursion and Union Find.
For some of the questions on Union Find, you may want to refer to some classes provided here.
Create a new package in IntelliJ IDEA, called ds1.student.unionfind
. Download the following files and save them to this new package.
These Java files refer to some other text (data) files, which you may want to look at or use. They go in a directory under the top level project in IntelliJ (in the same directory as the src
subdirectory, called data/
.
Do the homework assigned on D2L (see Submissions).
There are two parts to the homework: a programming assignment (hw9a) and a written assignment (hw9b). Be sure to scroll to the bottom of this page to see all of the details!
Make sure to submit each file to the correct folder. I will not move your homework to the correct folder (mostly because I won't look closely) - downloading your submissions and autograding them is automated!
hw9a: MyRecursion.java
Create a new package in IntelliJ IDEA, called: ds1.student.recursion
. Download the following file and save it to this package.
Look for all the TODO comments and implement the functions and provide any short answers (in comments) as requested.
One of the problems is to convert mickey mouse:
to mickey moose:
This is an example of a Fractal also known as a Recursive drawing
Each execution of your function should draw one circle.
hw9b: Union Find Problems
Do the following problems from the textbook on paper. Submit a Word doc, PDF, or text document with your answers.