Try Magic Notes and save time.Try it free
Try Magic Notes and save timeCrush your year with the magic of personalized studying.Try it free
Question

Suppose P is a formula in propositional logic containing n variables. Approximate the worst-case complexity of an algorithm that runs through all possible true/false values of the n variables to see if there is an assignment that makes P true.

Solution

Verified
Answered 4 months ago
Answered 4 months ago
Step 1
1 of 2

Given: PP is a propositional formula with nn variables.

Since there are at most two children to each vertex (true or false), a tree with nn vertices without children has a height of at least log2n\lceil \log_2n\rceil.

For each of the nn variables, there are 2 options: true or false.

Multiplication principle: \textbf{Multiplication principle: }If one event can occur in mm ways AND a second event can occur in nn ways, then the number of ways that the two events can occur in sequence is then mnm\cdot n.

22...2n repetitions=2n\begin{align*} \underbrace{2\cdot 2\cdot ...\cdot 2}_{n\text{ repetitions}}=2^n \end{align*}

Thus there are 2n2^n possible combinations of truth values for the nn variables and thus the tree representing the situation needs to have at least 2n2^n leaves.

The height of the tree is then at least log22n=n\lceil \log_2 2^n\rceil=\lceil n\rceil and thus the worst-case complexity of an algorithm that runs true all possible true/false values of hte nn variable is Θ(n)\Theta(n).

Create an account to view solutions

Create an account to view solutions

Recommended textbook solutions

Discrete Mathematics and Its Applications 7th Edition by Kenneth Rosen

Discrete Mathematics and Its Applications

7th EditionISBN: 9780073383095Kenneth Rosen
4,283 solutions
Discrete Mathematics and Its Applications 8th Edition by Kenneth Rosen

Discrete Mathematics and Its Applications

8th EditionISBN: 9781259676512Kenneth Rosen
4,397 solutions
Essentials of Discrete Mathematics 3rd Edition by David J. Hunter

Essentials of Discrete Mathematics

3rd EditionISBN: 9781284056242 (2 more)David J. Hunter
887 solutions
Discrete Mathematics with Applications 5th Edition by Susanna S. Epp

Discrete Mathematics with Applications

5th EditionISBN: 9781337694193Susanna S. Epp
2,641 solutions

More related questions

1/4

1/7