Over this week and next week we will be learning 4 graph algorithms. Rather than make you work from scratch, or from an empty graph project of mine, I have given you the answers from a student last semester. Unfortunately I picked the worst student and their version doesn't even compile.
Your task is to first get the Graph h in the Files section to compile. Then you need to read through it carefully and correct wherever they got the logic wrong. Little bugs are everywhere, but you'd only be able to find them if you understand the algorithms.
Debugging other people's code is the majority of your job in real life. Hence, this counts double.
Someone pointed out it would be nice to know the scope of the bugs so you don't freak out too hard. Remember, you do not need to rewrite any of this. All of the bugs are either missing variables or small logic tweaks.
Connect, Add, CopyCon, struct definitions each have 2 or fewer
LoopInternal has 3 or fewer
LoopExternal has 4 or fewer
LoopCopy has 2 or fewer
BestDistance has 4 or fewer
As an example of severity, the last person to ask for help in the office found a place where I changed one variable for another, and one where I mixed up != and >. Or was it
You can do 50-85% of this by eyeball, but there are some you'll have to use the debugger on.
#pragma once #include
#include #include #include #include #include