Re: O-notation



Ronny Mandal wrote:
> for (i = 1; i<= n; i++)
> for (j = 1; j<=n; j = 2 *j)
>
> Since this contains two loops tht increments their index by 2*1, 2*2,
> 2*3 ...2*n, and the outer is linear I would say that the running-time
> is n(log n)^2.

You'd be better off doing your own homework.

Hint:
for (j = 1; j<=n; j = 4 * j)
for (j = 1; j<=n; j = 2 * j)
are the same O

--
Pat


.



Relevant Pages

  • Re: comparision operator
    ... and pasted the exact line from you code (or homework, ... (Hint: spaces count) ... Prev by Date: ...
    (comp.unix.shell)
  • Re: differential equation question
    ... >Just give a hint .. ... this is homework problem... ... don't use power series unless you know a theorem that says all ... Prev by Date: ...
    (sci.math)
  • differential equation question
    ... Just give a hint .. ... this is homework problem... ... I was thinking of power series type of thing. ... Prev by Date: ...
    (sci.math)
  • Re: New Horizons to Pluto
    ... I think it's painfully obvious you just won't take the hint and do some ... homework before posting. ... Prev by Date: ...
    (sci.space.history)
  • Re: Binary to Decimal
    ... lmh86 wrote: ... > Can anyone suggest any other methods that does not implement built-in ... This sounds like some homework, ... hint you into some direction, ...
    (microsoft.public.dotnet.languages.vc)