
October 3rd, 2012, 06:20 AM
#1
Big O Notion Help for project
hello guys i am in 3th years of studying in uni,i am toke this example as a heading of my project and need answers for it with all thanks, i am software eng
first part: O(g(n)) for this:
(n + 3 )(n + n2+ 4)
5logn+3n+1000
Logn+ 100 +1/ n2
100n2+ ½ n3 +5
(3n2 + 4)3
second part : number of operation of this
1)
if (condition)
{ cout<<”Hello”<<endl; }
else
{
for (i = 0; i < N; i++) {
cout<<”Hi”<<endl;
}
}
2)for (i = 0; i < N; i++) {
for (j = i+1; j < N; j++) {
sequence of statements
}
}
3)for (i = 0; i < 2*N; i++) {
sequence of statements
}
for (j = 0; j < M1; j++) {
sequence of statements
}
4)
void fun(int k)
{
for (i = 0; i < N; i++) {
sequence of statements
}
}
void main(){
//declaration statements
for (i = 0; i < N; i++) {
fun(i);
}
}

October 3rd, 2012, 01:48 PM
#2
Re: Big O Notion Help for project
Give us your answers first and then we can help you out.

October 4th, 2012, 03:27 AM
#3
Re: Big O Notion Help for project

October 4th, 2012, 05:13 AM
#4
Re: Big O Notion Help for project
this my answer for first part:
first: n3
sec:n
third:n2
forth:n2
five:n6

October 4th, 2012, 08:25 AM
#5
Re: Big O Notion Help for project
Originally Posted by javaguys
this my answer for first part:
Your notation is somewhat ambiguous since you don't separate multiplication and powerof clearly.
Still the Ordo complexity of an expression is determined by the fastest growing term when N approaches infinity. In my view you've got it wrong in the third and fourth example. They should be O(logN) and O(N^3) respectively.

October 4th, 2012, 09:56 AM
#6
Re: Big O Notion Help for project
thanks bro,i want o(n) of it, as i said above for:
1)
(n + 3 )(n + n^2+ 4)
2)5logn+3n+1000
3)Logn+ 100 +1/ n^2
4)100n^2+ ½ n^3 +5
5)(3n^2 + 4)^3
still wait answers
Last edited by javaguys; October 4th, 2012 at 09:59 AM.

October 4th, 2012, 10:35 AM
#7
Re: Big O Notion Help for project
Originally Posted by javaguys
still wait answers
I think you got it all right except for 3 and 4 (for which I gave suggestions in my previous reply).
Last edited by nuzzle; October 4th, 2012 at 10:46 AM.

October 4th, 2012, 10:51 AM
#8
Re: Big O Notion Help for project
O(logN) and O(N^3) for third and fourth this is true answer?
hmmm, what about part B bro?

October 4th, 2012, 01:34 PM
#9
Re: Big O Notion Help for project
Originally Posted by javaguys
O(logN) and O(N^3) for third and fourth this is true answer?
Yes, I would say so. The Ordo complexity is determined by the term that grows the fastest asymptotically. And that's the term you picked in all cases except in 3 and 4. In 3 it's log(n) and in 4 it's n^3 so these will determine the complexity.
But don't take what I say at face value. After having studied software engineering for 3 years at a university you should know this better than I do.
hmmm, what about part B bro?
Yes what about it? If you suggest something with a motivation I'll tell you what I think.

October 4th, 2012, 02:24 PM
#10
Re: Big O Notion Help for project
i know how to find number of operation, but i need to know big o of this codes in part b, i want to tell you that just first material talking about algorithms so sorry if i need just Little help
Posting Permissions
 You may not post new threads
 You may not post replies
 You may not post attachments
 You may not edit your posts

Forum Rules

Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.
Featured
