## Related questions with answers

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

VerifiedGiven: $P$ is a propositional formula with $n$ variables.

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

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

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

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

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

The height of the tree is then at least $\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 $n$ variable is $\Theta(n)$.

## Create an account to view solutions

## Create an account to view solutions

## Recommended textbook solutions

#### Discrete Mathematics and Its Applications

7th Edition•ISBN: 9780073383095Kenneth Rosen#### Discrete Mathematics and Its Applications

8th Edition•ISBN: 9781259676512Kenneth Rosen#### Essentials of Discrete Mathematics

3rd Edition•ISBN: 9781284056242 (2 more)David J. Hunter## More related questions

1/4

1/7