Question

How would I figure out the basic operations of this code? I am not sure what...

How would I figure out the basic operations of this code? I am not sure what is and isn't classified as a basic operation. Thank you.

for ( j = 1; j < n; j++ )

{

           for ( k = j; k < n; k++ )

          {

                   v++;

          }

          for ( k = 1; k < n; k++ )

          {

                  h++;

          }

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
for ( j = 1; j < n; j++ )
{
    for ( k = j; k < n; k++ )
    {
        v++;
    }
    for ( k = 1; k < n; k++ )
    {
        h++;
    }
}

operations inside for loops v++ and h++ are considered as basic operations in this code.
Total number of operations = O(n^2)
Add a comment
Know the answer?
Add Answer to:
How would I figure out the basic operations of this code? I am not sure what...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone help me out with part b? I am not sure what I am doing...

    Can someone help me out with part b? I am not sure what I am doing wrong. the first answer I got was 22 degrees and that wasn't right either. Thank you for your help. 2 2/4 points Previous Answers My Notes Ask Your Teacher - 70.00 kgs at another corner, and a my 115.00 kg mass the third comer Find the magnitude and An equilateral triangle 10 mon a side has am 30.00 kg mass at one corner, am...

  • Please Show the FULL solution, I am not sure how to figure out the last digit...

    Please Show the FULL solution, I am not sure how to figure out the last digit of the number! The first digit of a six-number digit number is 1. This digit 1 is now moved from the first digit position to the end, so it becomes the last digit. The new 6 digit number is now 3 times larger than the original number. What are the last three digits of the original number?

  • Hi, I am trying to figure out how write a code to read in a list...

    Hi, I am trying to figure out how write a code to read in a list of integers separated by commas into an array in c++, while ignoring the commas. example input 5, 2, 8, 6, 3, 6, 9, 7 example array: int arr[] = {5,2,8,6,3,6,9,7};

  • I am not sure how to do this question. i did it this way but ut turns out wrong. and i need hep please. thank you.

    I am not sure how to do this question. i did it this way but ut turns out wrong. and i need hep please. thank you.

  • I am not sure how to fill this this out? Thanks!

    I am not sure how to fill this this out? Thanks!

  • MONTE CARLO SIMULATION: So I am trying to figure out a MATLAB code to generate a...

    MONTE CARLO SIMULATION: So I am trying to figure out a MATLAB code to generate a Monte Carlo simulation for my mean and standard deviation values. I have a material (fat) with mean and standard deviation values as well as mean and standard deviation values for its thickness. I need to figure out a code that will plot and generate a monte carlo simulation. Any help would be greatly appreciated. Thanks

  • Can you write the code for this It's for Visual Basic I am having a hard...

    Can you write the code for this It's for Visual Basic I am having a hard time getting it to work Telling me error Thank u I will rate a good so other students can learn from this

  • I need help with this c++ code. This is my first computer science course. I have...

    I need help with this c++ code. This is my first computer science course. I have not learned arrays but I am learning vectors. I am also required to write this code without do loops or any other form of advanced coding technique. Please help me figure out this code using the basic coding techniques that you would find in an introduction to cs. Thank you for your help, I don't even know where to start :)

  • I am trying to figure out why my C code is outputting "exited, segmentation fault". The...

    I am trying to figure out why my C code is outputting "exited, segmentation fault". The game is supposed to generate 4 random numbers and store them in the "secret" array. Then the user is suppose to guess the secret code. The program also calculates the score of the user's guess. For now, I printed out the random secret code that has been generated, but when the game continues, it will output "exited, segmentation fault". Also, the GetSecretCode function has...

  • I know there are 32 possible gametes for f, but I am not sure how to...

    I know there are 32 possible gametes for f, but I am not sure how to go about figuring out what all of them are, please help. Thank you! 4. How many different types of gametes can be formed by individuals of the following genotypes: a) AaBb b) AaBB c) AaBbcc d) AaBBcc e) AaBbcc f) AaBbCcDcEd What are the gametes in each case?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT