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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:56:17+00:00 2026-06-11T13:56:17+00:00

I am asked to determine use the time and space complexities of simple algorithms.

  • 0

I am asked to determine use the time and space complexities of simple algorithms. The problem is that I don’t fully understand where the numbers come from. From example we were provided it counts addition, subtraction, division, and multiplication as primitive operations.

Here I am posting pseudo code of my algorithm which calculates standard deviation by using formula we were provided.

I see 2 * (n – 1) addition symbols, 1 division symbol, 2 multiplication symbol and 1 subtraction symbol.

What else I must count here for time complexity? And what to do with space complexity?

// X is passed array, and N is number of elements in array.
Algorithm calculateStandardDeviation(X, N)
{
    private double arraySum;
    private double arrayMean;
    private double xi2;
    private double standardDeviation;

    foreach (arrayValue in X)
    {
        arraySum = arraySum + arrayValue;
    }

    arrayMean = sum / N;

    foreach (arrayValue in X)
    {
        xi2 = xi2 + Math.Pow(arrayValue, 2);
    }

    standardDeviation = Math. Sqrt(((1/N) * () * xi2) - Math.Pow(arrayMean, 2));

    return standardDeviation;
}
  • 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-11T13:56:18+00:00Added an answer on June 11, 2026 at 1:56 pm

    Algorithmic Complexity can, ironically, be as general or complex as you want. If you are working towards a big-oh O(…) notation complexity – as is the norm in computer science – @david robinson is correct with respect to your current situation.

    A for loop generally adds a dimension of N time complexity – where N is the number of runs your loop contains. Everything else you do runs in O(1) “constant” time (does NOT mean takes the same amount of physical time as another O(1) time op). Therefore, your time complexity is the linear addition of all your operations or O(N + N + 1 + 1+…) = O(2N). This, i’m sure you learned in class, reduces to O(N). Time complexity.

    Now for space complexity – same thing. Does anything grow as your input sizes grow? That would be a yes – your array grows as you add more elements to your array. Therefore it, too, grows as O(N). You have other constant space factors, but we’re dropping that for big-oh, giving you

    linear – O(N) – in time and space complexity.

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

Sidebar

Related Questions

I need to be able to determine which database to use at login time
I previously asked, How to determine the target of a symbolic link or Reparse
I asked a separate question (now deleted) for what I thought the actual problem
Today in my interview , i was asked to write a code to determine
I understand from my research that IE8 does annoying things like forcing itself into
I hope that this question hasn't been asked already, but I was looking for
I've been asked to determine whether a frame is an Ethernet or IEEE 802.3
I asked another question: https://stackoverflow.com/questions/1180240/best-way-to-sort-1m-records-in-python where I was trying to determine the best approach
Are there a finite number of questions that can be asked regarding a specific
I guess this question that would have already been asked here. I searched but

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.