Re: O-notation
- From: Pat Farrell <pfarrell@xxxxxxxxxx>
- Date: Mon, 21 Nov 2005 10:40:40 -0500
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
.
- Follow-Ups:
- Re: O-notation
- From: Richard Harter
- Re: O-notation
- From: Ronny Mandal
- Re: O-notation
- References:
- O-notation
- From: Ronny Mandal
- O-notation
- Prev by Date: Re: "Reverse Doubling List", is there another name?
- Next by Date: [ counting sort ideea... ]
- Previous by thread: O-notation
- Next by thread: Re: O-notation
- Index(es):
Relevant Pages
|