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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:54:27+00:00 2026-06-15T12:54:27+00:00

I have an algorithm that runs in O(m) time. This algorithm takes in a

  • 0

I have an algorithm that runs in O(m) time. This algorithm takes in a set of data containing m entries.

The data is generated randomly by specifying a strictly positive integer input n. The number of entries generated is O(n log n).

Edit

Alone, the time complexity of generating the data is independent of n (or O(1)), which means given the integer n, the entries are instantly and randomly generated. The number of resulting entries is random, but is O(n log n). E.g. n = 10, then number of entries generated is some constant times 10 (log 10).

The data is generate before hand. Then the resulting m entries is fed into the algorithms as input.

Question

Can I then assume that the algorithm runs in O(n log n) time?

  • 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-15T12:54:28+00:00Added an answer on June 15, 2026 at 12:54 pm

    There are some ambiguities in your question that were either deliberately place to help you internalize the relationship between input size and run time complexity, or simple caused by miscommunication.

    So as best as I can interpret this scenario:


    Your algorithm complexity O(m) is linear with respect to m.

    So since We assume that generating the data is independent of input. i.e. O(1)., your time-complexity is only dependent on some n that you specify that generates entries.

    So yes, you can say that the algorithm runs in O(n log n) time, since it doesn’t do anything with the input of size m.


    In response to your updated question:

    It’s still hard to follow because some key words refer to different things. But in general I think this is what you are getting at:

    • You have a data set as input, that is size O(n log n), given some specific n.
    • This data set is used as input only, it’s either pre-generated, or generated using some blackbox that runs in O(1) time regardless of what n is given to the blackbox. (We aren’t interested in the blackbox for this question)
    • This data set is then fed to the algorithm that we are actually interested in analyzing.
    • The algorithm has time-complexity O(m), for an input of size m.
    • Since your input has size O(n log n) with respect to n, then by extension your O(m) linear-time algorithm has time complexity O(n log n), with respect to n.

    To see the difference: Suppose your algorithm wasn’t linear but rather quadratic O(m^2), then it would have time-complexity O(n^2 log^2 n) with respect to n.

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

Sidebar

Related Questions

I have written an algorithm that takes geospatial data and performs a number of
If I have some algorithm that runs at best n time and at worst
I have an algorithm that finds a value in a cell, for this case
I have this algorithm that I want to implement on VB6. Sub Main() dim
If I have an algorithm that takes n log n steps (e.g. heapsort), where
I have an algorithm that always runs steps A, C, D in that order.
I have an algorithm that takes 7 days to Run To Completion (and few
I have a method in my algorithm that runs a very tight loop on
I have an algorithm that finds the minimum of function/n on Rn. And I
I have an algorithm that recursively makes change in the following manner: public static

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.