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

  • Home
  • SEARCH
  • 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 6859189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:15:08+00:00 2026-05-27T02:15:08+00:00

I am watching Intro to Algorithms (MIT) lecture 1. Theres something like below (analysis

  • 0

I am watching Intro to Algorithms (MIT) lecture 1. Theres something like below (analysis of merge sort)

T(n) = 2T(n/2) + O(n)

Few questions:

  • Why work at bottom level becomes O(n)? It said that the boundary case may have a different constant … but I still don’t get it …
  • Its said total = cn(lg n) + O(n). Where does O(n) part come from? The original O(n)?
  • 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-05-27T02:15:08+00:00Added an answer on May 27, 2026 at 2:15 am

    Although this one’s been answered a lot, here’s one way to reason it:

    If you expand the recursion you get:

    t(n) = 2 * t(n/2) + O(n)
    t(n) = 2 * (2 * t(n/4) + O(n/2)) + O(n)
    t(n) = 2 * (2 * (2 * t(n/8) + O(n/4)) + O(n/2)) + O(n)
      ...
    t(n) = 2^k * t(n / 2^k) + O(n) + 2*O(n/2) + ... + 2^k * O(n/2^k)
    

    The above stops when 2^k = n. So, that means n = log_2(k).

    That makes n / 2^k = 1 which makes the first part of the equality simple to express, if we consider t(1) = c (constant).

    t(n) = n * c + O(n) + 2*O(n/2) + ... + (2^k * O(n / 2^k))
    

    If we consider the sum of O(n) + .. + 2^k * O(n / 2^k) we can observe that there are exactly k terms, and that each term is actually equivalent to n. So we can rewrite it like so:

    t(n) = n * c + {n + n + n + .. + n}    <-- where n appears k times
    t(n) = n * c + n *k
    

    but since k = log_2(n), we have

    t(n) = n * c + n * log_2(n)

    And since in Big-Oh notation n * log_2(n) is equivalent to n * log n, and it grows faster than n * c, it follows that the Big-O of the closed form is:

    O(n * log n)

    I hope this helps!

    EDIT

    To clarify, your first question, regarding why work at the bottom becomes O(n) is basically because you have n unit operations that take place (you have n leaf nodes in the expansion tree, and each takes a constant c time to complete). In the closed-formula, the work-at-the-bottom is expressed as the first term in the sum: 2 ^ k * t(1). As I said above, you have k levels in the tree, and the unit operation t(1) takes constant time.

    To answer the second question, the O(n) does not actually come from the original O(n); it represents the work at the bottom (see answer to first question above).

    The original O(n) is the time complexity required to merge the two sub-solutions t(n/2). Since the time complexity of the merge operation is assumed to grow (or decrease) linearly with the size of the problem, that means that at each level you will have a sum of O(n / 2^level), of 2^level terms; this is equivalent to one O(n) operation performed once. Now, since you have k levels, the merge complexity for the initial problem is {O(n) at each level} * {number of levels} which is essentially O(n) * k. Since k = log(n) levels, it follows that the time complexity of the merge operation is: O(n * log n).

    Finally, when you examine all the operations performed, you see that the work at the bottom is less than the actual work performed to merge the solutions. Mathematically speaking, the work performed for each of the n items, grows asymptotically slower than the work performed to merge the sub-solutions; put differently, for large values of n, the merge operation dominates. So in Big-Oh analysis, the formula becomes: O(n * log(n)).

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

Sidebar

Related Questions

Watching SO come online has been quite an education for me. I'd like to
I am watching Apple's overall intro to Game Center. It says that to be
I have a UITextField inside a UIScrollView (a few levels deep). I am watching
After watching The Dark Knight I became rather enthralled with the concept of the
After watching: The Clean Code Talks -- Inheritance, Polymorphism, & Testing I checked my
After watching the webinar, skimming over the BuckyBook PDF, and following the Eclipse RCP
I remember watching a webcast from Mark Russinovich showing the sequence of keyboard keys
I was watching Rob Connerys webcasts on the MVCStoreFront App, and I noticed he
I was just watching a video on MSDN Channel 9 which can be found
I was watching a tutorial on Rails and was very impressed that you could

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.