Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Classes L and NL Section 8.4 Giorgi Japaridze Theory of Computability.

Similar presentations


Presentation on theme: "The Classes L and NL Section 8.4 Giorgi Japaridze Theory of Computability."— Presentation transcript:

1

2 The Classes L and NL Section 8.4 Giorgi Japaridze Theory of Computability

3 Sublinear complexity 8.4.a Giorgi Japaridze Theory of Computability Sublinear (less than linear) time complexity does not make sense (why?). But it does make sense as space complexity. We need to slightly modify our TM model of computation though. The modification consists in separating the input tape from the work tape. The work tape remains read/write, but the input tape is read-only. When counting space complexity, we only look at how many cells of the work tape are utilized. This separation is not artificial. In real life, it is often the case that read-only input is bigger than the computer’s memory (“work tape”). CD-ROM is an example. Or, if we want to focus on fast computations, computer’s memory becomes even more limited --- registers only. Logarithmic space computability can be seen as computability with registers only. Or, more generally, computability with memory that is “much smaller than” input.

4 L and NL defined 8.4.b Giorgi Japaridze Theory of Computability Definition 8.17 1. L is the class of languages that are decidable in logarithmic space on a deterministic Turing machine. In other words, L = SPACE(log n) 2. NL is the class of languages that are decidable in logarithmic space on a nondeterministic Turing machine. In other words, NL = NSPACE(log n)

5 {0 k 1 k | k  0}  L 8.4.c Giorgi Japaridze Theory of Computability Example 8.18 Remember the machine for {0 k 1 k | k  0} from Section 7.1, which works by zigzagging back and forth. What is its space complexity? To improve space (but not time!) complexity, we can set up a different machine. Instead of zigzagging, such a machine just makes one pass through the input, and records on its work tape --- in the binary notation --- the number m of 0s and the number n of 1s. Holding m and n requires only logarithmic space. Then the machine compares these two numbers by zigzagging. This does not take any additional space.

6 PATH  NL 8.4.d Giorgi Japaridze Theory of Computability Example 8.19 Remember our polynomial-time algorithm for PATH from Section 7.2, which works by marking nodes. What is its space complexity? We can set up a nondeterministic logarithmic space machine for PATH. Starting from s as the “current node”, every time it guesses a next node --- among the nodes pointed to by the current node --- and jumps to it, until it hits t or has already visited more nodes than the number of nodes in the graph without hitting t. In the former case it accepts, and in the latter case rejects. At any time, the machine thus only needs to remember “the current node”, as well as the node count. How much space do these two pieces of information take? So, the whole algorithm runs in logarithmic space.


Download ppt "The Classes L and NL Section 8.4 Giorgi Japaridze Theory of Computability."

Similar presentations


Ads by Google