Altitude Game: Forums  

Go Back   Altitude Game: Forums > Altitude Discussion > The Water Cooler
FAQ Community Calendar

The Water Cooler Discuss unrelated topics. Keep it clean. Keep it nice.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-16-2011, 03:46 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default a huge favor plzplzplz

I know there are a lot of programmers in the community, and I was wondering if someone could give me some quick help.

I'm taking ap compsci with data structures and i would like someone to give me a nice definition and explanation for big O, pointers, and linked lists. Plz no wiki pages or anything, I want a more understandable definition, and I would appreciate it if code used to explain the concepts were in Java.

I really need this!!1 (I must get a 100% on my next test!)

Any help is appreciated
Reply With Quote
  #2  
Old 09-16-2011, 03:59 AM
malakas malakas is offline
Senior Member
 
Join Date: Jan 2010
Location: All up in they
Posts: 153
Default

you want help with a big O?
Reply With Quote
  #3  
Old 09-16-2011, 03:59 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

The Big O Measure for runtime
Reply With Quote
  #4  
Old 09-16-2011, 04:00 AM
malakas malakas is offline
Senior Member
 
Join Date: Jan 2010
Location: All up in they
Posts: 153
Default

so you want someone to help you measure the duration of the big O?
Reply With Quote
  #5  
Old 09-16-2011, 04:14 AM
mikesol mikesol is offline
Super Moderator
 
Join Date: Jul 2009
Location: Portland, OR
Posts: 2,183
Default

For big-o basics I'd strongly encourage you to read this: http://rob-bell.net/2009/06/a-beginn...ig-o-notation/. It's a super simplistic - super easy to understand guide that you should be able to understand.

As far as pointers go - Java doesn't really have pointers in the way that C++ does. You don't really define a pointer to some data location - Java does all the work for you. What's your question with this? Do you not understand what a pointer is?

Linked lists are a little bit more complicated. I don't think code will help you out too much here but if you're interested a simpler version of a linked list in java can be found here: http://stackoverflow.com/questions/1...d-list-in-java. Java has a wonderful built-in linked list class that you should use if you ever wanted to use a linked list.

For a good explanation of what a linked list *is* I'd check out this website: http://cis.stvincent.edu/html/tutori...sts/lists.html. It has some good pictures that really make it clear.

Hope that helps!
__________________
We can has sigs?
Reply With Quote
  #6  
Old 09-16-2011, 05:16 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

Mike, thank you so much for your help!

By pointers, I meant I am sketchy with the concept as I am weak on the whole object oriented programming side of things.

Furthermore, my tests involve me writing code on paper, which I struggle at, while I am fine doing it on computer (esp. b/c i can test it and see what is wrong).

Can you please give me some advice on how to solve this problem?
Reply With Quote
  #7  
Old 09-16-2011, 05:56 AM
Kennedy Kennedy is offline
Senior Member
 
Join Date: Nov 2010
Location: On scum's trail
Posts: 989
Default

Quote:
Originally Posted by malakas View Post
so you want someone to help you measure the duration of the big O?
I lol'd for about a minute.
Reply With Quote
  #8  
Old 09-16-2011, 10:15 AM
Tekn0 Tekn0 is offline
Senior Member
 
Join Date: Dec 2010
Posts: 1,548
Default

Quote:
Originally Posted by dr. carbon View Post
By pointers, I meant I am sketchy with the concept as I am weak on the whole object oriented programming side of things.
Do NOT confuse object oriented programming with pointers. It has nothing to do with pointers.

If you want to have a good idea of pointers start with basic, simple C tutorials.

C++ and C are *NOT* the same languages, if you know what happens under the hood and the details of the code emitted by C and C++ compilers you'll realize they are rather different.
Reply With Quote
  #9  
Old 09-16-2011, 10:22 AM
Tekn0 Tekn0 is offline
Senior Member
 
Join Date: Dec 2010
Posts: 1,548
Default

Quote:
Originally Posted by dr. carbon View Post
Furthermore, my tests involve me writing code on paper, which I struggle at, while I am fine doing it on computer (esp. b/c i can test it and see what is wrong).
Over time while writing code you need to think like a compiler (or interpreter). This takes practise. There's no easy way around it. There are scenarios in real life where such a skill is useful.

Also, once you have a clear idea of what you're doing, briging it out on paper is more about language semantics. The algorithm should never be a problem to express.
Reply With Quote
  #10  
Old 09-16-2011, 03:06 PM
Ribilla Ribilla is offline
Senior Member
 
Join Date: Nov 2010
Location: In ur base, defusin' ur bombs.
Posts: 2,659
Default

I had to do a little of this on my firest year course, though with simplistic code. I don't think there are any quick fixes, you just have to imagine you are a single run of the code and see how that scales with the inputs.

If you can't manage that, then look for loops and loops within loops. Each loop gives you a factor of n on your big O, so a loop within a loop within a loop gives you an algorithmic complexity of n^3. For good examples, I would work through from first principals the complexity of sorting algorithms. Quicksort would be a good place to start.
Reply With Quote
  #11  
Old 09-17-2011, 09:58 PM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

Hmm, I don't think i'm confusing it with obj. programming, I just need to now the concept of how pointers work b/c I am using an abstraction of Java right now which requires me to use pointers. Furthermore, for me to understand how link lists work, I need to know how pointers work.

@Rib, I know how the basic bigO cases work, I want to know how to test for the worst case since bigO tests for the upper bounds. My teacher did some algebra in the board for some examples to test for worst case, but i was completely lost.
Reply With Quote
  #12  
Old 09-17-2011, 10:37 PM
Mt.Vesuvius Mt.Vesuvius is offline
Senior Member
 
Join Date: Jan 2010
Location: If anyone asks, Tmic isnt my pimp..
Posts: 2,475
Default

Quote:
Originally Posted by malakas View Post
so you want someone to help you measure the duration of the big O?
Hahahahaha
Reply With Quote
  #13  
Old 09-17-2011, 11:02 PM
lemon lemon is offline
Senior Member
 
Join Date: Jul 2010
Posts: 123
Default

Quote:
Originally Posted by dr. carbon View Post
Hmm, I don't think i'm confusing it with obj. programming, I just need to now the concept of how pointers work b/c I am using an abstraction of Java right now which requires me to use pointers. Furthermore, for me to understand how link lists work, I need to know how pointers work.

@Rib, I know how the basic bigO cases work, I want to know how to test for the worst case since bigO tests for the upper bounds. My teacher did some algebra in the board for some examples to test for worst case, but i was completely lost.
Errr, you definately seem confused about some things, or terms at the very least. And as others have said, In Java you just can't work with pointers as such so your task can't possibly require you to use them. Maybe you could give us the actual task and then we could help you out better?
Reply With Quote
  #14  
Old 09-17-2011, 11:23 PM
Tekn0 Tekn0 is offline
Senior Member
 
Join Date: Dec 2010
Posts: 1,548
Default

Quote:
Originally Posted by dr. carbon View Post
Hmm, I don't think i'm confusing it with obj. programming, I just need to now the concept of how pointers work b/c I am using an abstraction of Java right now which requires me to use pointers. Furthermore, for me to understand how link lists work, I need to know how pointers work.
Like I said before, start with C for pointers. The concepts of linked lists is extremely simple, don't worry once you learn it you'll be like "duh! this is so ez & yet cool!"
Reply With Quote
  #15  
Old 09-18-2011, 04:55 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

@lemon I told you, i'm using an abstraction called javatown where its a little different.
Reply With Quote
  #16  
Old 09-18-2011, 04:56 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

And I have no real tasks, just a test to take in a week.
Thanks for the help though, guys
Reply With Quote
  #17  
Old 09-18-2011, 05:23 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

What are good methods of figuring out recursive algorithms without wasting time thinking through the whole process (my teacher tells me to avoid this), or is it just something people develop naturally.

All I do right now is 1) Identify base case and 2) figure out what changes every time, but I still struggle with this. Idk if this will simply be solved with more practice.
Reply With Quote
  #18  
Old 09-19-2011, 03:07 PM
Boko Boko is offline
Banned
 
Join Date: Feb 2010
Location: Cocation
Posts: 1,392
Default

Lol, just as it happens I'm getting a course about algorithms this semester. Just wanted to say that the stuff in here actually helped me, because the teacher is a total retard who can't explain anything and just uses random powerpoint sheets he found.
Reply With Quote
  #19  
Old 09-19-2011, 03:46 PM
Tekn0 Tekn0 is offline
Senior Member
 
Join Date: Dec 2010
Posts: 1,548
Default

Quote:
Originally Posted by dr. carbon View Post
What are good methods of figuring out recursive algorithms without wasting time thinking through the whole process (my teacher tells me to avoid this), or is it just something people develop naturally.
Don't worry too much about the recursive functions. In practice you will find many times, iterative implementations being preferred over recursive ones, mostly because of the call-stack memory overhead (unless they're implemented without using a stack frame for each invocation and provide sufficiently more clarity over other implementations).

Quote:
All I do right now is 1) Identify base case and 2) figure out what changes every time, but I still struggle with this. Idk if this will simply be solved with more practice.
With recursion there are 3 things:

1. Identify that the problem can be expressed as a function of itself.

2. Knowing when to stop the recursion.

3. Is it worth doing recursively in terms of performance (for now, for academic purposes you don't need to bother with this)

Start with simple recursive functions like Factorial and Quicksort. And over time you will be able to identify "similarity" that allows you to do things using recursive functions.

Sometimes for complex cases you will know only after you've written the code 90%... "Duh! wait.. i can do this recursively". It does take practice.
Reply With Quote
  #20  
Old 09-20-2011, 03:49 AM
dr. carbon dr. carbon is offline
Senior Member
 
Join Date: Aug 2010
Posts: 163
Default

Quote:
Originally Posted by Boko View Post
Lol, just as it happens I'm getting a course about algorithms this semester. Just wanted to say that the stuff in here actually helped me, because the teacher is a total retard who can't explain anything and just uses random powerpoint sheets he found.
haha, I don't really understand my teacher very well either, and I have no idea what he teaches off, but I can't find it on the internet.
Reply With Quote
  #21  
Old 09-20-2011, 05:17 AM
Boko Boko is offline
Banned
 
Join Date: Feb 2010
Location: Cocation
Posts: 1,392
Default

Quote:
Originally Posted by dr. carbon View Post
haha, I don't really understand my teacher very well either, and I have no idea what he teaches off, but I can't find it on the internet.
It's not about the part that we don't understand what he's saying.. It's about the fact that he himself does not know what he's saying. He's just retarded.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:23 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
2008 Nimbly Games LLC