User Tools

Site Tools


opus:fall2012:tedmist1:part3

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

data Keyword 3

Function Pointer

Definition

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.

References

data Keyword 3 Phase 2

Recursive tree traversal

Definition

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.

References

data Keyword 3 Phase 2 Phase 2

Recursive tree transversal

Definition

A form of going through a Tree via recursion. Recusion is calling the function while still inside the function before finishing the original function.

References

Demonstration

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

discrete Keyword 3

Permutation

Definition

A way, esp. one of several possible variations, in which a set or number of things can be ordered or arranged

References

discrete Keyword 3 Phase 2 Phase 1

De Morgan's Law

Definition

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).

References

discrete Keyword 3 Phase 2 Phase 2

Permutation

Definition

A way, esp. one of several possible variations, in which a set or number of things can be ordered or arranged

References

Demonstration

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)

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

  1. 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:

  1. Set Size of Stack
  2. Push choice of number onto stack
  3. (Hit Stack Overflow)
  4. Display?
  5. Pop numbers off of stack
  6. (Hit Stack Underflow)
  7. Be Happy with what you did
  8. 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 = <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

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.

opus/fall2012/tedmist1/part3.txt · Last modified: 2012/12/01 18:35 by tedmist1