Question: ( Encodings and Runtime ) The runtime of an algorithm ( Turing machine ) is always measured as a function if its input length. The
Encodings and Runtime The runtime of an algorithm Turing machine is always measured as
a function if its input length. The goal of this problem is to help you understand what that means
and why it can be subtle.
a Prove that there is no polynomialtime algorithm that takes as input a natural number
written in binary and outputs ie writes to its tape the number again written in
binary
Hint: Show that the expected output for this problem is so long that it is impossible for a
polytime algorithm to even write it down.
b Give a highlevel description of a polynomialtime algorithm that takes as input a natural
number written in unary, ie the string ubracedotsubrace and outputs the number written in
binary Explain why your algorithm is correct and why it runs in polynomial time.
Hint: You can use without proof the fact that Turing machines can perform basic arithmetic
operations on binary numbers, like addition and multiplication, in polynomial time.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
