The **floor** of $x$ is the greatest integer less than $x$. The **ceiling** of $x$ is the least integer greater than $x$. These values are denoted $\lfloor x \rfloor$ and $\lceil x \rceil$ respectively.
%%ANKI
Basic
How is the floor of $x$ denoted?
Back: $\lfloor x \rfloor$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779649-->
END%%
%%ANKI
Basic
How is the ceiling of $x$ denoted?
Back: $\lceil x \rceil$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779663-->
END%%
%%ANKI
Basic
When does $\lfloor x / 2 \rfloor = \lceil x / 2 \rceil$?
Back: When $x$ is even.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779668-->
END%%
%%ANKI
Basic
When does $\lfloor x / 2 \rfloor \neq \lceil x / 2 \rceil$?
Back: When $x$ is odd.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
What values of $x$ satisfy $\lfloor x \rfloor = \lceil x \rceil - 1$?
Back: Non-integral values.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1709831032489-->
END%%
%%ANKI
Basic
What values of $x$ satisfy $\lceil x \rceil = \lfloor x \rfloor + 1$?
Back: Non-integral values.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1709831032496-->
END%%
%%ANKI
Basic
What values of $x$ satisfy $\lfloor x \rfloor = \lceil x \rceil + 1$?
Back: None.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1709831032505-->
END%%
%%ANKI
Basic
What values of $x$ satisfy $\lceil x \rceil = \lfloor x \rfloor - 1$?
Back: None.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1709831032513-->
END%%
%%ANKI
Basic
For what values $k$ is horizontal and vertical shifting of $\lfloor x \rfloor$ the same?
Back: Integral values.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
When does C operator `/` behave like floor division?
Back: When the result is a nonnegative value.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779705-->
END%%
%%ANKI
Basic
When does C operator `/` behave like ceiling division?
Back: When the result is a nonpositive value.
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1708110779716-->
END%%
%%ANKI
Basic
How does C evaluate `10 / 3`?
Back: `3`
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
If $n$ is even, what integer value does $\lfloor n / 2 \rfloor$ evaluate to?
Back: $n / 2$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1714182124789-->
END%%
%%ANKI
Basic
If $n$ is odd, what integer value does $\lfloor n / 2 \rfloor$ evaluate to?
Back: $(n - 1) / 2$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1714182124796-->
END%%
%%ANKI
Basic
If $n$ is even, what integer value does $\lceil n / 2 \rceil$ evaluate to?
Back: $n / 2$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1714182124804-->
END%%
%%ANKI
Basic
If $n$ is odd, what integer value does $\lceil n / 2 \rceil$ evaluate to?
Back: $(n + 1) / 2$
Reference: Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
<!--ID: 1714182124809-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what value of $Bias$ satisfies the following identity? $$\left\lceil \frac{x}{y} \right\rceil = \left\lfloor \frac{x}{y} + Bias \right\rfloor$$
Back: $(y - 1) / y$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124840-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what value of $Bias$ satisfies the following identity? $$\left\lceil \frac{x}{y} \right\rceil = \left\lfloor \frac{x + Bias}{y} \right\rfloor$$
Back: $(y - 1)$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714184300367-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what operator satisfies the following identity? $$\left\lceil \frac{x}{y} \right\rceil = \left\lfloor \frac{x}{y} \;\square\; \frac{y - 1}{y} \right\rfloor$$
Back: $+$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124853-->
END%%
%%ANKI
Basic
What intuition explains why the following identity holds for integers $x$ and $y > 0$? $$\left\lceil \frac{x}{y} \right\rceil = \left\lfloor \frac{x}{y} + \frac{y - 1}{y} \right\rfloor$$
Back: $(y - 1) / y$ only affects the RHS if and only if $x / y$ is not an integer.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124860-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what value of $Bias$ satisfies the following identity? $$\left\lfloor \frac{x}{y} \right\rfloor = \left\lceil \frac{x}{y} - Bias \right\rceil$$
Back: $(y - 1) / y$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124874-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what value of $Bias$ satisfies the following identity? $$\left\lfloor \frac{x}{y} \right\rfloor = \left\lceil \frac{x - Bias}{y} \right\rceil$$
Back: $(y - 1)$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714184300372-->
END%%
%%ANKI
Basic
Given integers $x$ and $y > 0$, what operator satisfies the following identity? $$\left\lfloor \frac{x}{y} \right\rfloor = \left\lceil \frac{x}{y} \;\square\; \frac{y - 1}{y} \right\rceil$$
Back: $-$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124867-->
END%%
%%ANKI
Basic
What intuition explains why the following identity holds for integers $x$ and $y > 0$? $$\left\lfloor \frac{x}{y} \right\rfloor = \left\lceil \frac{x}{y} - \frac{y - 1}{y} \right\rceil$$
Back: $(y - 1) / y$ only affects the RHS if and only if $x / y$ is not an integer.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714182124884-->
END%%
%%ANKI
Cloze
For any integer $n$, floor expression {$\lfloor n / 2 \rfloor$} is equal to ceiling expression {$\lceil (n - 1) / 2 \rceil$}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714349367669-->
END%%
%%ANKI
Cloze
For any integer $n$, ceiling expression {$\lceil n / 2 \rceil$} is equal to floor expression {$\lfloor (n + 1) / 2 \rfloor$}.
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714349367676-->
END%%
%%ANKI
Basic
What identity generalizes the following? $$\left\lfloor \frac{n}{2} \right\rfloor = \left\lceil \frac{n - 1}{2} \right\rceil$$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
<!--ID: 1714349367682-->
END%%
%%ANKI
Basic
What identity generalizes the following? $$\left\lceil \frac{n}{2} \right\rceil = \left\lfloor \frac{n + 1}{2} \right\rfloor$$
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
* Ronald L. Graham, Donald Ervin Knuth, and Oren Patashnik, *Concrete Mathematics: A Foundation for Computer Science*, 2nd ed (Reading, Mass: Addison-Wesley, 1994).
* Thomas H. Cormen et al., *Introduction to Algorithms*, 3rd ed (Cambridge, Mass: MIT Press, 2009).