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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:27:32+00:00 2026-06-07T01:27:32+00:00

I have a counting algorithm for which I am trying to get a general

  • 0

I have a counting algorithm for which I am trying to get a general big-o description. It is horribly nested and horribly exponential. Here it is:

 1. For each T_i in T
 2. For k = 1 to max_k
 3. For each of 2^k*(n choose k) items
 4. For each t in T_i
 5. check if the item is in t...etc.

Here is a line-by-line idea of each running time

  1. This is a simple partitioning and I’m going to just give it a constant c1.
  2. max_k is a small number, always less than n, perhaps around 4 or 5. I will use k below.
  3. This loop always runs 2^k*(n choose k) times
  4. By considering line 1 constant, we can generalize this line and know it will never fire more than 2^n times in total in worst case, but generally will run a fraction of 2^n times, so we will call this one (2^n)/c2
  5. This is the simple if-statement operation inside all these loops, so c3.

Multiplying all these together gives:

c1 * k * 2^k * (n choose k) * (2^n)/c2 * c3

Since I want a big-O representation, ignoring constants gives:

k * 2^k * (n choose k) * (2^n)

It is known that (n choose k) is bounded above by (n * e / k)^k, so:

O(k * 2^k * (n * e / k)^k * (2^n))

My question is, what can I ignore here… 2^n is certainly the dominating term since n is always larger than k, and typically much more so. Can this be simplified to O(2^n)? Or O(2^terrible)? Or should I leave in the 2^k, as in O(2^k * 2^n)? (or leave all the terms in?)

My understanding is that if k or max_k can compete or surpass n, then they are vital. But since they are always dominated, can they be discarded like lower order terms of polynomial running times? I suppose all the exponential running time mess is confusing me. Any advice is greatly appreciated.

  • 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-07T01:27:34+00:00Added an answer on June 7, 2026 at 1:27 am

    My understanding is that if k or max_k can compete or surpass n, then
    they are vital

    True, but the other way around isn’t – meaning – it cannot be ignored when it comes to big O notation, even if it does not compete with n. It can be ignored only if max_k is bounded with a constant (there is a constant c such that k <= c). For example – O(n * logk) algorithms, are not O(n), since the k factor is not bounded and thus there exists a k such that nlogk > c*n for every constant c.

    Since the expression you got is a product, all you can ignore are constants, which in your case – is only e getting you O(k*2^k * (n/k)^k * 2^n).

    If k is bounded, then you can remove it from the expression as well in big O notation, and you will get O(n^k* 2^n). Note that even in this case, although n^k << 2^n, it still cannot be ignored, because for every constant c there exists some n such that c*2^n < n^k *2^n, so the algorithm is not a O(2^n) one.

    Smaller factors can be ignored when it comes to addition. If k < n then O(n + k) = O(n), because there is a constants c,N such that for all n > N: c*n < n + k, but this is of course not true when dealing with product.

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

Sidebar

Related Questions

I have read a counting sort algorithm which is like this: Counting Sort(A[1,..n]) //C[1,...k]
I have found this question in the one site which was about counting sort
i have a silly doubt regarding counting sort.What is the need to get the
We have a big (~215 bundles and counting) osgi (felix+springdm) project, build with maven
I have a bit counting method that I am trying to make as fast
I'm trying to solve an algorithm problem involving chess. Suppose I have a king
I have developed a program that is counting the number of lines in a
I have one question about searching and counting files in directories and subdirectories. I
I have to make an android app. It is about counting Bunks for college
Does anyone know how to or have some code on counting the number of

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.