Is it possible to find an algorithm which, for a given program (in C++, for exam
ID: 3775103 • Letter: I
Question
Is it possible to find an algorithm which, for a given program (in C++, for example), will recognize if this program satisfies the following conditions (answer Yes or No):
(a) For any input from {1, 2, 3}, the considered program finishes its work after at most one hour and outputs a result.
(b) For the input 0, the considered program finishes its work and outputs a result.
(c) For the input 0, the considered program never finish its work.
(d) The length of a program is at most 1000 bytes, and the program does not use the operations of subtraction and division.
Explanation / Answer
(a) For any input from {1, 2, 3}, the considered program finishes its work after at most one hour and outputs a result.
Yes, its possible to find an algorithm that will compute seomthing on input from {1, 2, 3}
(b) For the input 0, the considered program finishes its work and outputs a result.
Yes, its possible to find an algorithm that the considered program finishes its work and outputs a result.
(c) For the input 0, the considered program never finish its work.
Yes, its possible to find an algorithm that the considered program never finish its work , it will keep on executing On and On in an infinite loop and never finsih its work. That is it will keep consuming CPU cuycles and will never finish
(d) The length of a program is at most 1000 bytes, and the program does not use the operations of subtraction and division.
Yes, defintely
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.