======Part 3 DUE DEC 1st====== =====Entries===== ====Entry 1: November 9th, 2012 DATA?==== * What action or concept of significance, as related to the course, did you experience on this date? Learned about shared and static object libraries on this day. My Notes: libraries: shared object && static object libraries shared: .so static: .a shared obj: MOST COMMONLY USED to update, no need to update every single file write code that uses functions that uses the library information. ldd shows that shared object file that ls relies upon just have what you wrote, with refrences to lib. much smaller in code, since copying lib pro: resulting file size = smaller cons: if lib dissappears the functions won't work. unpredictable behavior since you lost data points static obj: EASIER TO USE multiple functions in one library. need to change all files to update. * Why was this significant? The significance of this knowledge is that knowing the difference of what library you are about to create will change the ease-ability you are about to experience. * What concepts are you dealing with that may not make perfect sense? How to implement which library to use. * What challenges are you facing with respect to the course? BINARY TREES ====Entry 2: November 29, 2012 DISCRETE==== * What action or concept of significance, as related to the course, did you experience on this date? Re-learned about gd drawings, how to implement them, compile, and show via web browser. * Why was this significant? This knowledge will help me out with the eoce drawings that I will be needing to do. * What concepts are you dealing with that may not make perfect sense? Making the drawing to certain criteria. * What challenges are you facing with respect to the course? Certain math needing to create a certain path in a line. ====Entry 3: November 26, 2012==== * What action or concept of significance, as related to the course, did you experience on this date? Downloaded the latest version of Perl, 5.16.2, to my lab46 account. P.S. it takes a very long time, I do not recommend it. * Why was this significant? This is significant because it gives me the ability to use the latest version of Perl, and its latest libraries to use. * What concepts are you dealing with that may not make perfect sense? Certain implementation of libraries within the new Perl version. * What challenges are you facing with respect to the course? Still making headway with the Perl language, aspects of the language are still unknown to me. ====Entry 4: November ?, 2012==== * What action or concept of significance, as related to the course, did you experience on this date? We talked about queues and such on this day, was a lovely subject to talk about. * Why was this significant? This is significant because this not only helped with the binary tree project, but, as opposed to stacks it is another way for inputing values in an organized fashion. * What concepts are you dealing with that may not make perfect sense? Implementation of these sorting methods in various languages. * What challenges are you facing with respect to the course? Recursion and iteration via stacks and or queues. =====Keywords===== {{page>datapart3&nofooter}} {{page>discretepart3&nofooter}} =====Experiment 3===== ====Question==== Since I had a gain of sudden interest of the Perl language, I was wondering to myself if I could re-write a program, primarily the stack program that was due, using this as a great learning experiment to introduce myself to the Perl language. ====Resources==== - Perl books located in the Lair. ====Hypothesis==== The result of my experiment will be a working stack program, just written in Perl. In doing so you can push & pop numbers from a list in any fashion you so choose. But you must set a certain size to the stack unless the program will not run as it is intended, plus you can display your stack at any point in time. ====Experiment==== Compile and run the program to see if it works. Structure: - Set Size of Stack - Push choice of number onto stack - (Hit Stack Overflow) - Display? - Pop numbers off of stack - (Hit Stack Underflow) - Be Happy with what you did - Quit ====Data==== Stack Program Version 1.0 $top = -1; do { print "\nStack Operations\n"; print "----------------\n"; print "0. Display Stack\n"; print "1. Set Size\n"; print "2. Push\n"; print "3. Pop\n"; print "9. Quit\n"; print "Your Selection: "; chomp($input = ); if ($input eq "0") #Display Stack { if ($top == -1) { print "Stack Has Yet To Be Created\n"; } else { print "Your Stack: {"; print "@value "; print "\b\b} \n"; } } if ($input eq "1") #Set Size { print "Set Size To Stack: "; chomp($size = ); } if ($input eq "2") #Push { if ($top == $size - 1) { print "STACK OVERFLOW\n"; } else { $top++; print "Enter Value To Push Onto Stack: "; $value = ; chomp($value); push(@value, $value); print $value." Has Been Pushed Onto The Stack\n"; } } if ($input eq "3") #Pop { if ($top == -1) { print "STACK UNDERFLOW\n"; } else { $top--; $value = pop(@value); print $value." Has Been Popped Off Of The Stack\n"; } } } while ($input ne "9"); Stack Program Version 1.1 (Using Sub Function Calls): $top = -1; sub display { print "Your Stack: {"; print "@value "; print "\b\b} \n"; } sub push { $top++; print "Enter Value To Push Onto Stack: "; $value = ; chomp($value); push(@value, $value); print $value." Has Been Pushed Onto The Stack\n"; } sub pop { $top--; $value = pop(@value); print $value." Has Been Popped Off Of The Stack\n"; } do { print "\nStack Operations\n"; print "----------------\n"; print "0. Display Stack\n"; print "1. Set Size\n"; print "2. Push\n"; print "3. Pop\n"; print "9. Quit\n"; print "Your Selection: "; chomp($input = ); if ($input eq "0") #Display Stack { if ($top == -1) { print "Stack Has Yet To Be Created\n"; } else { &display(); } } if ($input eq "1") #Set Size { print "Set Size To Stack: "; chomp($size = ); } if ($input eq "2") #Push { if ($top == $size - 1) { print "STACK OVERFLOW\n"; } else else { &push(); } } if ($input eq "3") #Pop { if ($top == -1) { print "STACK UNDERFLOW\n"; } else { &pop(); } } } while ($input ne "9"); Possible Results: lab46:~/perl/stack$ perl stacks.pl Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 1 Set Size To Stack: 3 Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 2 Enter Value To Push Onto Stack: 4 4 Has Been Pushed Onto The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 2 Enter Value To Push Onto Stack: 8 8 Has Been Pushed Onto The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 2 Enter Value To Push Onto Stack: 1 1 Has Been Pushed Onto The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 2 STACK OVERFLOW Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 0 Your Stack: {4 8 1} Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 3 1 Has Been Popped Off Of The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 3 8 Has Been Popped Off Of The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 0 Your Stack: {4} Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 3 4 Has Been Popped Off Of The Stack Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection: 3 STACK UNDERFLOW Stack Operations ---------------- 0. Display Stack 1. Set Size 2. Push 3. Pop 9. Quit Your Selection:9 ====Analysis==== Based on the data collected: * Was your hypothesis correct? Yes, my hypothesis was correct. * Was your hypothesis not applicable? My hypothesis was applicable. * Is there more going on than you originally thought? (shortcomings in hypothesis) Since I am new to the language there is always something that I fully don't understand or something that could be done in a different manner. * What shortcomings might there be in your experiment? Not enough commenting in the program for a person who has not seen this language before so they can understand what is going on and why. * What shortcomings might there be in your data? The data size could be larger to prove that there will not be any problems when I go this program goes into larger data sets. ====Conclusions==== Based on this experiment, I have gained a lot of knowledge, based on before I started, to this language. This knowledge is going to be quite helpful if I ever move on and use language for various other projects and experiments at hand.