======Part 1====== =====Entries===== ====September 02, 2011====
It was the best of times, and it was the worst of times... oh wait... wrong story. Anyway, disregard that previous statement. I hopefully will accomplish my task in being able to formulate words for these journal entries that are sufficient enough in my struggles to understanding these highler level programming concepts. Now, sadly I miss half of my classes for this course so I missed out on what was most likely a pretty awesome first day. I am obtaining half of the knowledge compared to the entire class and I hope I am capable of keeping up. This semester is nothing but classes with labs attached to them so I have an incredibly massive work load and at times it is hard for me to manage, but I am trying to do my best. Anyway enough with the brief introduction and onto the good bits. On this day as I sat and attentively payed attention and tried wrapping my measly little brain around the terminology and concept of just a singly linked list. I slowly became capable of such feats and somewhat conqured it. I still need to reference back to my old code but I am kind of capable of writing one out. We at first, went over the creation of a list. The birth, if I may, and boy was it glorious. Afterwards we moved our way to the insertion technique and not wanting to be impolite we inserted before the node that we wanted to put stuff in. Then came appending. Being a bully and pushing our way to the front. All in all, I learned a great deal moar on my first day in this class and I am looking forward to moar cakey goodness.
====September 09, 2011====Brimming with the knowledge and excitement the last class had brought me, I dared to venture out into the wild a little and I spoke up and tried giving some of the input I had. Very little and somewhat off but was an easy fix! I was kind of impressed with myself seeing as how even I consider myself to be a weaker breed of a programmer. It takes me a little longer to grasp some things and I pretty much need my hand held during the time of first learnings. If not I tend to struggle and tumble my way through... But... for some reason this came fairly quickly and somewhat easily to me. So when we were working on deletion of the nodes, I was pretty comfortable and was able to follow along easily. I even lended a hand to a fellow classmate and helped troubleshoot his code. After about 10 - 15 minutes we had it up and working properly. I have the code still, all I need to do is find a spot for it to put it in here.
====September 16, 2011====Things are really starting to get interesting. And the climate control has most certainly improved! The training is still somewhat difficult but we're working on doubly linked lists now. I had a pretty hard time catching up but I managed to tag along at a reasonable rate. Very much like a singly linked list besides the fact that we are now able to traverse the list. Meaning going up or down it, or even left to right. Heck, lets get crazy and make it a circle! Now then, I will not be doing that for I prefer to keep my sanity intact... and that definitely would have broken me... (looking ahead into the future a little bit, say about a week from now, I will have made a doubly linked list on my own with a star wars theme... holy $^@#$%^@ did that r4p3 my brain) So far these lists are cool and kind of a nice challenge to try and wrap your head around the logic and syntax. But it has me thinking... if this is what the first half of the year is going to be like... I dont really want to know what is still in store for us...
====September 30, 2011====On this day, as this month comes to an ending. We were taught something glorious! Stacks (aka stax, yo) as it was writtin on the board! Seriously matt, you employ some of the coolest teaching methods evAR. A stack is essentially a bunch of "blocks" or nodes in a list, a vertical one that is and using push() we can put rainbow colored candies into them and then with the help of our dear friend pop() we can take them back and not only that but reverse the order! Amazing! Also, the shortest proper sentence in the American/English language is, go. Weird, anyway, my job now is to get this stack to work with my doubly linked list that is star wars themed. push(bobafet) trololol I am having a hard time trying to figure out how to turn my stuff into a library but I feel like I'm getting close and I'll get there soon. As for this stack, since we just learned about it today, I wonder if it could be stand alone. As in it doesnt have to go on top of a list. The theory and logic behind it is very simple and easy to understand... I am however unsure of how the syntax will treat us... until next time journal, stay classy.
=====Terminology===== ====Pointer==== A data type whose value refers directly to (or "points to") another value stored elsewhere in the computer memory using its address.
#include
int main()
{
int a;
int *b; //the star is pixie dust (pointer)
char c;
a = 5;
printf("a is: %d\n", a);
b = &a;
printf("b is 0x%x\n", b);
printf("&b is 0x%x\n", &b);
printf("*b is 0x%d\n", *b);
printf("a is %d\n", a);
return(0);
}
Output: | |
---|---|
a is: | 5 |
b is: | 0x209d90d8 |
&b is: | 0x209d90d0 |
*b is: | 0x5 |
a is: | 5 |
b will never hold the contents of "a" but it can point to it and be like I want that
Pointers can only point to things of the same data type
====Version Control====It is a repository where you can store all of your data. It takes a snapshot of what you gave it and then you can add comments stating what changes you made. The repository allows you to access all of the committed files at the various versions you submitted them.
Double splat (**) (makes a half kirby) and points to another spot in memory
The output is:
This program was ran by typing: ./double_pointer
====Memory allocation (malloc(), new)====Malloc is the function used to create space inside of memory
And the output would be...
Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 23 Enter a number (-1 to quit): 345 Enter a number (-1 to quit): -1 index[0] input: 12 index[1] input: 23 index[2] input: 345====Linked Lists====
A dynamic list where you can add and subtract the elements whenever you want to
For example: [1]->[2]->[3]->[4]->NULL
The output would be...
Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 12 Enter a number (-1 to quit): -1 index[0] value = 12 index[1] value = 12 index[2] value = 12 index[3] value = 12 index[4] value = 12====Doubly Linked Lists====
A multi-directional dynamic list. Similar to linked list except the ladder is a linear dynamic list
For example: NULL<->[1]<->[2]<->[3]<->[4]<->NULL
The output is...
Enter a number (-1 to quit): 12 Enter a number (-1 to quit): 200 Enter a number (-1 to quit): 1 Enter a number (-1 to quit): -1 index[0] input: 12 index[1] input: 200 index[2] input: 1 Enter the index to insert before: 1 Enter a number for new node: 23 index[0] value: 12 index[1] value: 23 index[2] value: 200 index[3] value: 1====Popping====
Takes something off of the TOP of the list/stack
It takes the first number in your list and it traverses your list and compares to see if it is bigger. When its not it places it in that spot, so it then grabs that element and starts all over again. Produces a goliath baby for overhead
====Trees====trees naturally sort numbers. depending on your logic it will put the lowest or highest number on the bottom most leaf of the tree, on either the right or left side.
You can have an infinite amount of children and parents
parents spawn children. Those children can become parents if they themselves have children. But we do not ever let the parents touch the children. (but yet we do, because we're just sick like that)
====Hash Tables ====Can be thought of as a phone book. Such as, it is a multiple linked list. Typically used in searching if you are using a hash then outcome is a table. You would have a triply (possibly quadriply) linked list with a single alphabetic character per node with branching lists from each node containing the first character.
====((LIFO && FILO) != FIFO)====LIFO && FILO, both of these mean the same thing
And as a side note it was also discovered that this would be a very easy way to test if a word was a palindrome.
This is referencing a stack, for example:
Input: 1, 2, 3, 4, 5 1st last Output: 5, 4, 3, 2, 1 1st last====BIG-O Notation====
Big-O notation is used to describe the behavior of a function when the argument is infinity. However it is a little different when it comes to computers. Big-O notation is then used to classify algorithms by how they react to changes with input size.
=====Objectives===== ====My first linked list==== Within this section I will tackle the endeavor of my first linked list. ever. (and as an added bonus! :D I've included the notes and steps I took to get here) ===Method=== If i have success, great joy will be had by all... if not... well, death to the masses may insue. ===Measurement=== After many a hour I was able to write my first linked list. And it had it all. Granted it's very procedural... ===Analysis=== * How did you do? - Fairly well I think. I may have patted myself on the back * Room for improvement? - Is too tall Jones, too tall?... Yes. I would say I am not at the jedi master level yet... not even close * Could the measurement process be enhanced to be more effective? - Turn it into an infinite loop with a terminator. Right now it just goes through the processes once. * Do you think this enhancement would be efficient to employ? - Heck to the yes. * Could the course objective be altered to be more applicable? How would you alter it? - I'm not sure houw you could alter it to make it easier to understand... honestly he does a really good job at breaking the code down and attempting to essplain (done on purpose) it in fun and simple terms. ===The Code===
Iterator iter = numbers.iterator();
while(iter.hasNext()) //hasNext() is looking to see if there is an element at that index
{
Object o = iter.next();
}
I attempted this but couldnt get it to work, just showing there is more than one way to do this. I would rather use vectors over an array everytime unless I knew what the limitations were going to be. If it did have to go beyond the capabilities of that array then you would have to employ a larger array and copy all of the elements from the old one to the new one... the question is, why do that? when vectors exist.
====Variable Play[not finished]====
===Question===
===Resources===
===Hypothesis===
===Experiment===
===Data===
===Analysis===
===Conclusions===
====Doubly Linked List in Java====
===Question===
Can you make a linked list in Java?
===Resources===
===Hypothesis===
It is possible to make a linked list in Java, given the right amount of cake.
===Experiment===