1. For randomFractal, a good variant expression is (rightX - leftX). If we make a recursive call, then this expression is greater than 4, and the recursive call cuts the expression in half. Therefore,...


1. For randomFractal, a good variant expression is (rightX - leftX). If we make a recursive call, then this expression is greater than 4, and the recursive call cuts the expression in half. Therefore, each recursive call subtracts at least 2 from the expression. When the expression reaches 4 (or less), the recursion stops. Therefore, 4 is the threshold.


The method traverseMaze has a variant expression that is expressed in English as “the number of locations in the maze that do not yet have your name written on the ground.” This value is reduced by at least 1 during each recursive call, and when this value reaches zero, there can be no further recursive calls. Therefore, 0 is the threshold.





Dec 08, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here