|
The Water Cooler Discuss unrelated topics. Keep it clean. Keep it nice. |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
you want help with a big O?
|
#3
|
|||
|
|||
The Big O Measure for runtime
|
#4
|
|||
|
|||
so you want someone to help you measure the duration of the big O?
|
#5
|
|||
|
|||
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? |
#6
|
|||
|
|||
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? |
#7
|
|||
|
|||
I lol'd for about a minute.
|
#8
|
|||
|
|||
Quote:
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. |
#9
|
|||
|
|||
Quote:
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. |
#10
|
|||
|
|||
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. |
#11
|
|||
|
|||
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. |
#12
|
|||
|
|||
Hahahahaha
|
#13
|
|||
|
|||
Quote:
|
#14
|
|||
|
|||
Quote:
|
#15
|
|||
|
|||
@lemon I told you, i'm using an abstraction called javatown where its a little different.
|
#16
|
|||
|
|||
And I have no real tasks, just a test to take in a week.
Thanks for the help though, guys |
#17
|
|||
|
|||
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. |
#18
|
|||
|
|||
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.
|
#19
|
|||
|
|||
Quote:
Quote:
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. |
#20
|
|||
|
|||
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.
|
#21
|
|||
|
|||
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.
|
|
|