Math Physics

[Math] Intuitive understanding of $\lceil n/5 \rceil$ and $\lfloor n/5 \rfloor$

eomiso(Aesop) 2020. 10. 2. 18:26

In this post I would like to share my intuitive understanding of ceiling and floor notations.

 

Let's begin.
The intuitive difference between  $\lceil n/5 \rceil$ and $\lfloor n/5 \rfloor$ is quite straight forward.

 

1. $\lfloor n/5 \rfloor$

A floor notation can be understood as the quotient in a division. And by using this property(deriven from its definition) we can write a modular notation without using % operator.

remainder = n - 5(n/5)

* I know that we can simply use a % operator, but trust me, when you are dealing with byte operations and byte representation, there will be a time where you can't use the easy % operator option.

 

2. $\lceil n/5 \rceil$

A Ceiling notation can be undertood as $\text{quotient} + 1$.

 

Quite simple, but where could they possibly be used? Well this is an example from an algorithm called selection in worst-case linear time. The algorithm devides an array into 5 element-wise subarrays, with the last array sized as $n \mod 5$. Now we can simply represent the number of total subarrays as $\lceil n/5 \rceil$ and number of subarrays of full 5 items as $\lfloor n/5 \rfloor$.

@eomiso

This will make your mathematical notation much simpler, not to mention the better understanding of algorithmic text books.

 

Well that's it for today.

Au revoir.