diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2014-09-14 09:36:04 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2014-09-14 09:36:04 -0400 |
| commit | 7a8d199c921b24d3bc198025afd621a0a740288a (patch) | |
| tree | e0278e804a8ed4ebf3a0fc4665f42d3ef18b223a | |
| parent | 30e1f244e6381a0439a52e326fe7ca700fe19e7b (diff) | |
| download | cs224-7a8d199c921b24d3bc198025afd621a0a740288a.tar.gz | |
[ps1] add alternative solution for ps3
| -rw-r--r-- | ps1/main.tex | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ps1/main.tex b/ps1/main.tex index 65c7707..920cb3c 100644 --- a/ps1/main.tex +++ b/ps1/main.tex @@ -152,6 +152,14 @@ t = w} \section*{Problem 3} +\paragraph{First solution \emph{(too easy, feels like cheating).}} We saw in +class how to compute the most signigicant bit set to one. But observe that +\texttt{x \& $\sim$(x-1)} will clear all the bits of $x$ except for the least +significant bit set to one. Assuming access to a procedure \texttt{msb} to +compute the most significant bit set to one, we can simply define +\texttt{lsb(x) $:=$ msb(x \& $\sim$(x-1))}. + +\paragraph{Second solution.} Using Problem 2 and what we did in class, we assume that we have access to the following procedures: \begin{itemize*} |
