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.
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.
How to implement which library to use.
BINARY TREES
Re-learned about gd drawings, how to implement them, compile, and show via web browser.
This knowledge will help me out with the eoce drawings that I will be needing to do.
Making the drawing to certain criteria.
Certain math needing to create a certain path in a line.
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.
This is significant because it gives me the ability to use the latest version of Perl, and its latest libraries to use.
Certain implementation of libraries within the new Perl version.
Still making headway with the Perl language, aspects of the language are still unknown to me.
We talked about queues and such on this day, was a lovely subject to talk about.
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.
Implementation of these sorting methods in various languages.
Recursion and iteration via stacks and or queues.
Function Pointer
Instead of referring to data values, a function pointer points to executable code within memory. When dereferenced, a function pointer can be used to invoke the function it points to and pass it arguments just like a normal function call.
Recursive tree traversal
A tree traversal is the process of examining each node exactly once in a systematic way. Different traversals are classified and named by the process in which they examine the tree. A recursive tree traversal examines the tree recursively which is the process of calling a function within itself. One example of recursion is two mirrors faced towards each other creating an infinite recursion.
Recursive tree transversal
A form of going through a Tree via recursion. Recusion is calling the function while still inside the function before finishing the original function.
lab46:~$ Please Enter Values For Tree Traversal (-1 to quit): Enter Value: 2 Enter Value: 5 Enter Value: 7 Enter Value: 1 Enter Value: 8 Enter Value: 4 Enter Value: 0 Enter Value: 6 Enter Value: -1 lab46:~$ Your Numbers: 2,5,7,1,8,4,0,6 2 / \ 1 5 / / \ 0 4 7 / \ 6 8
Permutation
A way, esp. one of several possible variations, in which a set or number of things can be ordered or arranged
De Morgan's Law
In propositional calculus form: where: *¬ is the negation operator (NOT) *∧ is the conjunction operator (AND) *∨ is the disjunction operator (OR) *⇔ means logically equivalent (if and only if).
Permutation
A way, esp. one of several possible variations, in which a set or number of things can be ordered or arranged
lab46:~$ Enter First Number For Permutation: 3 Enter Second Number For Permutation: 1 Permutation Results: 3! / 1! = 5 (3,1), (2,1), (1,1), (1,3), (1,2)
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.
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.
Compile and run the program to see if it works.
Structure:
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 = <STDIN>); 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 = <STDIN>); } if ($input eq "2") #Push { if ($top == $size - 1) { print "STACK OVERFLOW\n"; } else { $top++; print "Enter Value To Push Onto Stack: "; $value = <STDIN>; 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 = <STDIN>; 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 = <STDIN>); 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 = <STDIN>); } 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
Based on the data collected:
Yes, my hypothesis was correct.
My hypothesis was applicable.
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.
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.
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.
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.