{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

LectureNotes26 - ECS 120 Lesson 26 Space Complexity Oliver...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECS 120 Lesson 26 – Space Complexity Oliver Kreylos Friday, June 1st, 2001 The last couple of lectures, we analyzed the time complexity of Turing Machines; in other words, we counted the number of computation steps a Turing Machine performs of an input word of given length. Another impor- tant property of Turing Machines is the amount of space they use, or, more exactly, the number of tape cells they ever look at during a computation. If this number is known in advance, it is not necessary to actually give a machine an infinitely long tape, but to only give it as many tape cells as it really needs. 1 Space Complexity The definition of the space complexity of a Turing Machine is very similar to the definition of time complexity (just replace every occurrence of “time” by “space:” Definition 1 (Space Complexity) Let f : N N be a function, and let M be a deterministic Turing Machine. If, on an input word of length n , the machine never moves its tape head past the first f ( n ) cells on its tape, the space complexity of M is f ( n ) . We also say that M runs in space f ( n ) , or that M is an f ( n ) space Turing Machine . If N is a nondeterministic Turing Machine, and no branch of computation of N on input word w scans past the first f ( n ) tape cells, then the space complexity of N is f ( n ) . We also say that N runs in space f ( n ) , or that N is an f ( n ) space nondeterministic Turing Machine . In our discussion of time complexity, we also introduced the complex- ity classes TIME ( f ( n ) ) as the set of all problems that can be decided by 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
O ( f ( n ) ) time Turing Machines. We define a classification of problems based on space complexity in the same way: Definition 2 (Space Complexity Classes) Let f : N N be a function. Then the class SPACE ( f ( n ) ) is the set of all problems that can be solved by deterministic Turing Machines with space complexity O ( f ( n ) ) , and the class NSPACE ( f ( n ) ) is the set of all problems that can be solved by nonde- terministic Turing Machines with space complexity O ( f ( n ) ) . 2 Space Complexity Analysis To analyze the space complexity of Turing Machines, we use the same tech- niques introduced in the chapter about time complexity: Counting of tape cells and asymptotic analysis using the big-O notation. As an example, let us reconsider the satisfiability problem for boolean formulas and analyze its space complexity. To recall, the algorithm to decide SAT is as follows: Algorithm SAT On input φ , 1. Create all possible assignments of the variables of φ to the values true/false. 2. For each assignment generated, evaluate φ on it and check if the result is true. If so, accept.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern