User Tools

Site Tools


opus:fall2011:kpryslop:part2

Part 2

Entries

Oct 3, 2011

First class of October and yeah stuff going on. Just to remind Matt I will not be here friday. Function Pointers.

October 14th, 2011

I do not know what we did on friday so today is up in the air for me. Sideways stacks yo? Now we work and this is fine with me.

October 17, 2011

Week eight and working on stuff and waiting for one email from a teacher. Joe's class was cancelled :), poor Joe.

October 24, 2011

First day of the last full week of October. Signals!!!

data Topics

Keyword 1 B

Doubly Linked Lists- Linked data structures that consists of a set of sequentially linked nodes. Each node contains two fields that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the list.

Keyword 2 B

Stack- Last in, first out (LIFO) abstract data type and data structure. Can have any abstract data type as an element, but is characterized by only three fundamental operations: push, pop and stack top.

Array-based- A certain amount of memory is determined before used.

Linked List-based- Memory is not determined before hand but can be.

Keyword 3 B

Pushing- Adds a new item to the top of the stack, or initializes the stack if it is empty. If the stack is full and does not contain enough space to accept the given item, the stack is then considered to be in an overflow state.

Keyword 4 B

Popping- Removes an item from the top of the stack. A pop either reveals previously concealed items, or results in an empty stack, but if the stack is empty then it goes into underflow state (It means no items are present in stack to be removed).

Keyword 5 B

Top- gets the data from the top-most position and returns it to the user without deleting it. The same underflow state can also occur in stack top operation if stack is empty.

Keyword 6 B

Overflow condition- When the stack is full and can not take any more input. Push is the cause of this.

Keyword 7 B

Underflow condition- When the stack has no data in it. Pop and Top cause this.

Keyword 8 B

LIFO or FIFO?- Stacks are a LIFO.

Keyword 9 B

Queues- particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position. This makes the queue a First-In-First-Out (FIFO) data structure.

Array-based- A certain amount of memory is determined before used.

Linked List-based- Memory is not determined before hand but can be.

Keyword 10 B

Enqueuing- Placing an item in a queue.

Keyword 11 B

Dequeuing- Removing an item from a queue.

Keyword 12 B

Overrun conditions- When the queue is full and can not take any more input.

Underrun conditions- When the queue has no data in it.

data Objective

Objective B

Describe how the data structures are allocated and used in memory

Method

The definitions on the opus.

Measurement

The definitions are very well done.

Analysis

  • Good
  • Yes
  • Yes
  • Yes
  • No the course objective is fine.

Experiments

Experiment 1 B

Question

What happens when you try to delete a number by zero?

Resources

My grandmother had an error message that got me thinking about this.

Hypothesis

I think that if a program was made to do this it would get a seg fault or a zero as the answer.

Experiment

#include<stdio.h>
int main()
{
        int num;
        num = 0;
        printf("Please enter a value: ");
        scanf("%d", &num);
        num = num / 0;
        printf("The answer is: %d\n", num);
        return(0);
}

Data

Please enter a value: 9 Floating point exception

Analysis

Based on the data collected: My hypothesis was worng.

Conclusions

Dividing by zero, you will not get what you thing you should.

Experiment 2 B

Question

What do you need to do to get decimals in a math program?

Resources

Experiment 1 B

Hypothesis

All you need to do is change any ints in the program to floats.

Experiment

#include<stdio.h>
int main()
{
        float a = 0;
        float b = 0;
        float c = 0;
        float d = 0;
        float e = 0;
        float num = 0;
        printf("Please enter a value for a: ");
        scanf("%f", &a);
        printf("Please enter a value for b: ");
        scanf("%f", &b);
        printf("Please enter a value for c: ");
        scanf("%f", &c);
        printf("Please enter a value for d: ");
        scanf("%f", &d);
        printf("Please enter a value for e: ");
        scanf("%f", &e);
        num = ((a + b) * (c - d)) / e;
        printf("The answer is: %f\n", num);
        return(0);
}

Data

The answer to the problem ((1+2) * (3-4)) / 5 = 0(with ints) or 1(with floats)

Analysis

Based on the data collected: My hypothesis was wrong.

Conclusions

What you really need to do is change all ints to floats and change all (%d)s to (%f)s.

Experiment 3 B

Question

6/2(1+2)=?

Resources

Tyler.

Hypothesis

The answer is 1.

Experiment

#include<stdio.h>
int main()
{
        int num;
        num = 6 / 2 * (1 + 2);
        printf("The answer is: %d\n", num);
        return(0);
}

Data

The computer has a certain way of answering the problem.

Analysis

Based on the data: My hypothesis was wrong.

Conclusions

People can not agree on an answer.

opus/fall2011/kpryslop/part2.txt · Last modified: 2011/10/31 17:22 by kpryslop