Search code examples
algorithmmathanalysisfloor

Meaning of floor in equations


By reading the title it may sound like a silly question, but I have a data structures exam tomorrow and some formulas I need to know for algorithm analysis are read as (n – floor(log (n + 1)). What is the meaning of floor?

Thanks


Solution

  • floor(x) is the largest integer not greater than x. You can easily find this information on the web, here for example.

    e.g.

    floor(1.12) = 1  
    floor(0.53) = 0
    floor(-3.4) = -4
    

    One thing that can confuse people is the floor of a negative value. Some might initially think that floor(-3.4) is -3 when in reality it is -4 by the definition of floor(x).


    As a note, floor(x) is often written as enter image description here.