Pink Poogle Toy Forum

The official community of Pink Poogle Toy
Main Site
NeoDex
It is currently Sat Oct 05, 2024 8:01 pm

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Big Oh Notation
PostPosted: Mon Sep 20, 2004 4:01 pm 
Newbie
Newbie

Posts: 2
Joined: Tue Sep 21, 2004 6:07 am
I was just about going crazy over my Data Structures and Algorithms homework when I thought mebby I should pay a visit to good old PPT and see if y'all could help me. Guess it's been awhile, since my username didn't exist anymore! Anyhow, we're learning about Big Oh notation, which I should know by now, since I learned about it for the first time three semesters ago. But, I just don't get it. Think any of you could help me on the basics? I know the Big Oh for searches, etc, like a linear search takes O(n), and a binary search takes O(log n), but how do you decide what Big Oh is for a regular snippet of code? It's so confusing!

Thanks, m'dears!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 20, 2004 9:35 pm 
PPT Student
PPT Student
User avatar

Posts: 388
Joined: Mon May 31, 2004 7:11 pm
When you go through say a for-loop. Go through the loop and figure out what exactly is going on inside, and then determine in your head how many times the index will iterate through the loop.

If you have a nested for-loop iterating the same number of times, the Big-Oh notation would be O(n^2). The loop inside the outer for-loop needs to finish completely before the outer for-loop iterates to the next index.


Image
Image
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 21, 2004 7:26 pm 
Newbie
Newbie

Posts: 2
Joined: Tue Sep 21, 2004 6:07 am
Thanks, that helped a bit, and another comp sci major told me about a book that will help, too! :-)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group