Search:

Type: Posts; User: EDale

Search: Search took 0.08 seconds.

  1. Re: Big O notation... can you check my answers for each code segment?

    So for #1 if n=10 then the loop executes 5 times. So if it's not O(log n) then it must be O(n) because the number of times it executes is proportional to n? Is that right?

    #3 yes that's what I...
  2. Big O notation... can you check my answers for each code segment?

    int sum = 0;
    for (int i = 0; i < n; i += 2)
    sum++; //I said this is O(log n) because if n=10 then this loop executes half the time. Not sure though. Or is it O(n)?




    int sum = 0;
    for (int i...
Results 1 to 2 of 2