Question

In: Computer Science

Determine the computational complexity of the following language: 0n1n "Computational complexity theory focuses on classifying computational...

Determine the computational complexity of the following language:

0n1n

"Computational complexity theory focuses on classifying computational problems according to their inherent difficulty, (how difficult they are to solve) and relating these classes to each other. A computational problem is a task solved by a computer. Some computational problems are impractical as the known algorithm takes too much time and memory to complete."

Solutions

Expert Solution

Computational complexity can be calculated by finding the time required to solve instances of a problem as a function of their sizes, using a Turing machine as the computer model.

In this question we have to find the computational complexity of processing language :

{0^n1^n | n>= 0}

DESIGNING A TURING MACHINE FOR THIS LANGUAGE :

The algorithm of the Turing Machine is as follows :

1. Change 0 to X

2.Move RIGHT to First "1" : If None : Reject ( to check for the where number of zereos are more than number of ones )

3.Change 1 to Y

4.Move to LEFT to Leftmost 0

5. Repeat the above steps until no more 0 are found

6. Make sure no 1 remains ( to check for the case where number of ones are more than number of zeroes )

Thus to compute complexity we find how many moves it takes for the single tape turing machine to process the Natural Language.

As can be seen from the algorithm , for every 0 , the machine moves n moves ahead to find the matching one and then they move back n steps to the next zero . This process is repeated for all n zereos.

This implies n*(2n) moves are required.

This can be simplified to n*n when analyzing complexity.

Thus , the computational complexity using Single Tape T.M. would be of the order O(n^2) .


Related Solutions

Find the computational complexity i.e. O(n) etc. for the following four loops and explain why you...
Find the computational complexity i.e. O(n) etc. for the following four loops and explain why you came to that answer: for (cnt1 = 0, i = 1; i <= n; i++) for (j = 1; j <= n; j++) cnt1++; for (cnt2 = 0, i = 1; i <= n; i++) for (j = 1; j <= i; j++) cnt2++; for (cnt3 = 0, i = 1; i <= n; i*=2) for (j = 1; j <= n; j++) cnt3++;...
Why do factoring and discrete log have the same computational complexity in cryptography?
Why do factoring and discrete log have the same computational complexity in cryptography?
Q)Determine the complexity of the following code chunks. Show all calculations. (Assume that f() has complexity...
Q)Determine the complexity of the following code chunks. Show all calculations. (Assume that f() has complexity O(1)). A)for(i=0; i<n; i++) m += i; B) for(i=0; i<n; i++)                   for(j=0; j<n; j++)                             sum[i] += entry[i][j]; C) for(i=0; i<n; i++)                   for(j=0; j<i; j++)                             m += j; D) i= 1; while(i< n) { tot += i; i= i* 2;} E) i= n; while(i> 0) { tot += i; i= i/ 2; } F) for(i=0; i<n; i++)                  for(j=0; j<n; j++)...
Describe how complexity theory applies to inpatient nursing.
Describe how complexity theory applies to inpatient nursing.
Traditional trade theory is basically a static theory of international exchange (i.e. it only focuses on...
Traditional trade theory is basically a static theory of international exchange (i.e. it only focuses on a point in time) leading to certain conclusions about the benefits likely to accrue to all participants. Explain both the limitations of this static perspective as well as the dynamic elements that are important (i.e. “dynamic” means refers to trade policy and openness over time). Please describe specific historical examples (other than the examples given in class from Korea, the US, and England) to...
Complexity of Integration Data integration appears simple in theory but in fact it can be a...
Complexity of Integration Data integration appears simple in theory but in fact it can be a very complex process, particularly in organizations where sensitive or personal information is used, such as health care. Based on this information, why is data integration important in a data management process? How critical is it to have a comprehensive integration plan, particularly in today’s world of health care? Provide examples to support your thoughts.
Not only are there different types of therapies, each theory focuses on a different aspect of...
Not only are there different types of therapies, each theory focuses on a different aspect of human behavior. So, what therapy would work if I had problems with my thoughts? What therapy would work if I had problems with my actions? What would work if I was troubled by my feelings? Here is a website that might help clarify the issue for you. After exploring the website, assess which theory of therapy is best for what kind of issue. http://psychcentral.com/therapy.htm
Determine whether or not the following languages are regular. If the language is regular then give...
Determine whether or not the following languages are regular. If the language is regular then give an NFA or regular expression for the language. Otherwise, use the pumping lemma for regular languages or closure properties to prove the language is not regular. 1) L = { 0 n1 k : k ≤ n ≤ 2k} 2) L = { 0 n1 k : n > 0, k > 0 } È { 1 k0 n : k > 0, n...
1) Discuss the complexity of building efficient algorithms in Game Theory (+150 words)
1) Discuss the complexity of building efficient algorithms in Game Theory (+150 words)
Determine the mindfulness of effective practice in healthcare operations by analyzing the complexity of the finance...
Determine the mindfulness of effective practice in healthcare operations by analyzing the complexity of the finance functions and reimbursement systems and the laws governing regulations.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT