
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Kowalczyk; Class: Algorithms Design And Analysis; Subject: Computer Science; University: Northern Michigan University; Term: Winter 2008;
Typology: Study notes
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Algorithm Design and Analysis 4/3/
Instructor: Mike Kowalczyk
Consider the function programHalts in Halt.java. Is it possible to write a correct implementation? After several attempts, it appears to be impossible, but can we prove it? Assuming that we have a correct implementation of programHalts, then we could also write the method thisProgramHalts, and then write our main program to do the opposite of whatever our program supposedly was going to do. Intuitively, such a function would allow us to predict the future outcome of our program as it is still running! Let’s reason this more carefully: If the program Halt.java halts, then the if statment evaluates to true, and then the program infinite loops, so Halt.java doesn’t halt. But if the program Halt.java doesn’t halt, then the else statment will execute, and the program will halt. Thus, we have a contradiction and our assumption that the method programHalts could be written is false. So we conclude that there is no algorithm that can always determine whether or not any given program halts on any given input. A decision problem with this property that no algorithm solves it in general is called an unde- cidable problem. So the halting problem is an example. Calculating the Kolmogorov complexity of a given string is another example of an undecidable problem. Does nondeterminism help? If we used a nondeterministic machine, could we solve an undecid- able problem? A deterministic machine (such as an NMU laptop) can simulate a nondeterministic machine, it just takes lots of time. Therefore, even a nondeterministic machine cannot solve the halting problem. Note that it is possible to solve the halting problem for specific cases, but not in general. An interesting question to ask yourself is: “Is it possible to solve the halting problem if we only restrict inputs to problems other than the same program itself?”, which throws a slight monkey wrench in our proof technique above.
A reduction, informally, is a way solving a problem using another. Example: getting to Chicago from Marquette reduces to the problem of finding a map. It also reduces to loading up Google maps, which in turn reduces to the problem of finding a computer with an Internet connection and a browser. We will use reductions to relate the complexity of different problems.