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 8416851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:53:03+00:00 2026-06-10T01:53:03+00:00

I recently read about time complexity and I found out that Quick sort has

  • 0

I recently read about time complexity and I found out that Quick sort has an average time complexity of O(nlog(n)).

Question 1: What I do not understand is how is the log(n) present in the time complexity equation?

Question 2: Why do we always use the big O notation to find the time complexity of algorithms? Why don’t we use other notations?

  • 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-10T01:53:05+00:00Added an answer on June 10, 2026 at 1:53 am

    How did the logn got into the complexity formula?

    • For each step, you invoke the algorithm recursively on the first and second half.
    • Thus – the total number of steps needed, is the number of times it will take to reach from n to 1 if you devide the problem by 2 each step.

      So you are actually looking for a k such that:

      n / 2 /2 / 2 / ... /2 = 1
              ^
           (k times) 
      

      But, note that the equation is actually: n / 2^k = 1. Since 2^logn = n, we get k = logn. So the number of steps (iterations) the algorithm requires is O(logn), which will make the algorithm O(nlogn) – since each iteration is O(n).

    Note: The complexity in here is not exact, quicksort in rare cases decays to O(n^2), it is depends on the pivot selection. The “devide the problem by 2 each step” is a simplification, but it does not change the average analyzis of the algorithm.

    Why use big O notation?

    It is simple and platform independent.

    The exact number of op (and sometimes even comparisons) is platform dependent. (If instruction set A is richer then instruction set B, it will probably need more ops).

    It is definetly not the only method used. For real life applications, the exact run time (in seconds) is very important factor and is often used.

    So, in short – big O notation gives us easy to calculate – platform independent approximation on how will the algorithm behave asymptotically (at infinity), which can divide the “family” of algorithm into subsets of their complexity, and let us compare easily between them.

    Also, other notations that are used are small o, theta and big/small omega.

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

Sidebar

Related Questions

I have read about the push technologies recently. Using it real-time data streaming is
I've read about Single-Page Applications recently and wanted to try one out. After watching
Recently i read an article is about prevent brute-force attack. It said that automatically
Recently, I read a post on Stack Overflow about finding integers that are perfect
I recently read about a new Google-code hosted (open source) project from Google that
I have recently read topics about memory fragmentation: How to solve Memory Fragmentation and
I recently read an article about password hashing . How are MD5 or SHA1
I recently read an article about c#-5 and new & nice asynchronous programming features
I recently read a post about no longer needing to declare ivars as well
I recently read a post online about rotating text with css. This appealed to

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.