flâneur — a map of the web's best reading

Recursive Backtracking · Wiki · CS198 / Documentation / Courses · GitLab

code.stanford.edu · saved by 1 readers

This assignment has 4 parts: Debugging/Warmup, Predictive Text, Banzhaf Power Index, and Redistricting. The first part of the debugging exercise has students practice with using the five debugger control buttons (continue, stop, step in, step out, step over) to walk through a solver for the Towers of Hanoi puzzle. There shouldn't be any special insight here, if you're helping students with this, just make sure that they're actually pressing the correct buttons as instructed by the writeup. In the second part of the debugging exercise, students construct test cases to unearth a very subtle bug in code to solve the subset sum problem. The bug in the recursive call is update of sumSoFar variable is written as sumSoFar += v[index] rather than sumSoFar + v[index], which causes the sumSoFar variable to be incorrectly modified from iteration to iteration of the for loop. This bug should surface whenever there are two or more choices to make inside the for loop, which means that the for loop r

This assignment has 4 parts: Debugging/Warmup, Predictive Text, Banzhaf Power Index, and Redistricting. The first part of the debugging exercise has students practice with using the five debugger control buttons (continue, stop, step in, step out, step over) to walk through a solver for the Towers of Hanoi puzzle. There shouldn't be any special insight here, if you're helping students with this, just make sure that they're actually pressing the correct buttons as instructed by the writeup. In the second part of the debugging exercise, students construct test cases to unearth a very subtle bug

Explore this link on the map →

related reading