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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:43:45+00:00 2026-05-17T02:43:45+00:00

Do the two algorithms have the same theta characterization of Θ(n^2)? int sum =

  • 0

Do the two algorithms have the same theta characterization of Θ(n^2)?

int sum = 0;
for (int i = 0; i < n; i++ )
    for (int j = 0; j < n * n; j++ )
        sum++;

int sum = 0;
for ( int i = 0; i < n; i++)
    for ( int j = 0; j < i; j++)
        sum++;

If not then does this mean that this characterization is not Θ(n^3)?

int sum = 0;
for ( int i = 0; i < n; i++)
    for ( int j = 0; j < i * i; j++ )
        for ( int k = 0; k < j; k++ )
            sum++;
  • 1 1 Answer
  • 3 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-17T02:43:45+00:00Added an answer on May 17, 2026 at 2:43 am

    @Dan, For the first one did you really mean j < n * n rather than j < n? If so, the time complexity of the first one is Θ(n^3), isn’t it?

    If you meant j < n, then I believe the first two are both Θ(n^2): The first one takes n^2 steps, and the second one takes 1 + 2 + … + n = n(n+1)/2 which is Θ(n^2).

    I’m thinking the 3rd one is Θ(n^4), but it’s harder to prove. Definitely O(n^4).

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

Sidebar

Related Questions

I have two algorithms that I'm implementing: AlgorithmA which works with Vector values and
I have given run-time functions for two algorithms solving the same problem. Let's say
I have written a RNG class which holds different algorithms, however it does not
Dictionary cannot have two values with same key. please tell which logic/algorithm being used
I have a relatively simple algorithm that walks an std::vector looking for two neighbouring
I am benchmarking the cache behaviour of two search algorithms that operate on a
Lots of resources say that there are two types optical flow algorithms. And Lucas-Kanade
I have two algorithms with time complexities of O(n log n) and O(n log3
Any algorithms that would help? I'm gunning at something to help me nail this
I have studied the two graph traversal algorithms,depth first search and breadth first search.Since

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.