Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7754181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:14:37+00:00 2026-06-01T12:14:37+00:00

I came across places where floors and ceilings are neglected while solving recurrences. Example

  • 0

I came across places where floors and ceilings are neglected while solving recurrences.

Example from CLRS (chapter 4, pg.83) where floor is neglected:

enter image description here

Here (pg.2, exercise 4.1–1) is an example where ceiling is ignored:
(EDIT: I gather from public opinion that this is somewhat fishy.)

enter image description here

In fact in CLRS (pg.88) its mentioned that:

"Floors and ceilings USUALLY do not matter when solving recurrences"

My questions:

  1. Here does "usually" means ALL cases ? If yes, i can just forget them all the time.
  2. If not, then when do floors and ceilings really count while solving recurrences ?

Note: This ain’t a homework problem. I thought about it while I was refreshing my DS and algo concepts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:14:38+00:00Added an answer on June 1, 2026 at 12:14 pm

    The floor and ceiling functions satisfy the following inequalities for all x:

    • x−1 < ⌊x⌋ ≤ x

    • x ≤ ⌈x⌉ < x+1

    Thus, in the first example, we have ⌊n / 2⌋ ≤ n / 2. Also, since the logarithm is a monotone increasing function, we know that lg ⌊n / 2⌋ ≤ lg(n / 2). Putting these together, we get the first inequality 2(c ⌊n / 2⌋ lg ⌊n / 2⌋) + n ≤ cn lg(n / 2) + n.

    The second example actually contains an error: c lg ⌈n / 2⌉ + 1 is never less than but can be equal to c lg(n / 2) + 1. However, it is true that c lg ⌈n / 2⌉ + 1 ≤ c lg(n / 2 + 1) + 1, which we can then bound from above by, say, c lg(n / 2) + 2 (assuming that n ≥ 2) and thus derive the desired conclusion that T(n) ∈ O(lg n).

    In fact, the second example contains other errors too: even with the assumptions stated in the following paragraph (which you did not quote), the last = sign should be ≤.

    (Ps. Phew, this was a real pain to type without LaTeX. That, if nothing else, is why questions like these are better asked on math.SE.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to C++ and while learning i came across a lot of places
While reading the QuickCheck Manual , I came across the following example: prop_RevRev xs
I came across this question on an interview questions thread. Here is the question:
I came across a strange behavior while theming Drupal. I turned a few modules
I came across this presentation while browsing SO some time ago, and it relates
In underscore.js source in many places I came across if (obj.length === +obj.length) Can
While reading Learning Perl , I came across a problem about regular expressions. In
i came across an interview question which asks while searching a value in an
I came across a interview question that asked to remove the repeated char from
We recently came across some sample code from a vendor for hashing a secret

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.