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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:33:36+00:00 2026-05-29T04:33:36+00:00

Sum <- 0 // 1 Operation for i <- 1 to n do //

  • 0
Sum <- 0  // 1 Operation 
for i <- 1 to n do // 2n operations
 for j <-1 to n do // 2(n-1) operations
  k <-1 // 1 operation
while k < n do // n-1 operations
k <- k *c // 2 operations 
sum <- sum +1  // 2 operations 

In total the number of operations in the code are :

1+2n+2(n-1)+1+(n-1)+2+2 == 5n+3 total # of operations ,

is this how you calculate it , because i understand the concept of each stmt has 3 portions to it ( Comparison, Assignment, Incrementation )

please feel free to correct me is my observations are incorrect

  • 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-29T04:33:37+00:00Added an answer on May 29, 2026 at 4:33 am

    No, that’s probably incorrect.

    First of all: You’re thinking too hard. At least for the purposes of Big-O calculations, you can probably treat each assignment as a single operation, no matter whether it’s a constant assignment or a calculated value.

    Second of all: You aren’t thinking hard enough. The fourth line is a single operation, but it’s run n * n times, so it should be counted as n^2, not 1. Similarly for other lines in loops.

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

Sidebar

Related Questions

I just wrote this code: private double PerformOperation(OperationEnum operation, double aggregateValue, double sourceValue) {
I don't understand why this is occurring. Take the following piece of psuedo code:
SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest
Simple sum of digits code. It compiles but when executed, the last cout gives
How can I have SQL repeat some set-based operation an arbitrary number of times
I need to calculate the mean-squared error of a 16-bit operation for an arbitrary
I am trying to optimize some python code (to speed up some matrix operations),
I have two collections that I want to intersect, and perform a sum operation
I have people and places data as: Person entity has IList<DateRangePlaces> each having IList<Place>
To sum it up, there are two basic trains of thought: The private field

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.