bg287

ENG 114

Posted in eng114 by bnmng on 2012 08/30

Metaphor a figure of speech description of something as if it were something else, thereby enhancing our insight.

Rhythm the varying speed, intensity, elevation, pitch, loudness, and expressiveness of speech, especially poetry.

Symbol: a specific word, idea or object that may stand for ideas, values, persons, or ways of life.

Denotation: the literal or primary meaning.

Connotation: Layers of suggestion that words acquire through usage.  Connotation is partly personal which is why no two readers read the same poem.

CS381 Notes

Posted in cs381 by bnmng on 2012 08/30

Chapter 1: Foundations of Logic

Mathematical

Mathematical logic includes a formal language, precice notation.

Propositional Logic is the logic of compound statements using boolean connectives.

A proposition is a declarative statement that is either true or false.  Propositional logic includes combining propositions with connectives (also called operators).

Understand the contrapositive.  Reverse each element, then switch them.  The contrapositive has the same truth table as the original.

 

Excersises

a) Swimming is not allowed or there are sharks.

b) swimming is allowed only if there are no sharks

( p can-imply q ) and ( not p can imply q )

Swimming is allowed can imply that there are sharks, AND swimming is not allowed can imply that there are sharks

p  q | !p    p->q     !p->q    p->q^!p->q
1 1    0        1              1                    1
1 0    0        0             0                    0
0 1    1         1              1                   1
0 0    1        1              0                   0

 

If two compound statements have the same truth table, they are equivalent.

 

CS361 Notes

Posted in cs361 by bnmng on 2012 08/30

C++ Not completely OO, but “Object Centered”.

When defining class, consider necessary attributes.  Like for a class representing a car, think of make, mileage, number of doors, etc.  Classes can include other classes; like a car can contain an engine which in turn has attributes.  Also consider behaviors.

Attributes generally correspond to private member data; behaviors generally correspond to public functions.
Data encapsulation or data hiding, that is putting variables or functions into the private area, is important for shared programming.
Bad Example:

public: int [] getdata() {return somearray; } //Bad because arrays are returned by address.

Better Example

public: void getarray(int A[]) { for ( int i=0; i<10; i++) { A[i]=somearray[i];}}

CS381 20120828 Class Notes

Posted in cs381 by bnmng on 2012 08/28

DISCRETE STRUCTURES

Syllabus, Notes and Homework assignemnts at <a href=”http://www.cs.odu.edu/~jhe/CS381/Fall12/DiscreteMathFall12-index.html”>http://www.cs.odu.edu/~jhe/CS381/Fall12/DiscreteMathFall12-index.html</a&gt;

Homework by hardcopy due at beginning of next class.

We don’t have to bring our books to class.

This course seems to be about learning logical thinking and precise notation to express logical statements.

The idea is to use logic and logical notation to express real world problems

csc210 Final Project Instructions

Posted in csc210 by bnmng on 2011 04/22

Write a C++ program to create an array of linked lists. The program will store variables as they come from a file in a hash table (to be explained later). The program will also keep track of the number of accesses to each variable.

You will need to modify the node class to hold two data fields, a string and a count field. The program will use an array of linked lists to store variables in memory. The program will use an array of linked lists to store variables in memory. You will go to each array position by using a hash function to select the array element.

Declare the array with the following constant
const int PRIME=5;
Do not create a separate class for the array of bags; use the existing bag class only.

You will select each array position by hashing. After selecting the appropriate index, search the linked list to see if the string or variable is present. If it is, then update the count field by adding 1. If it is not present, then create a new node (storing it at the head of the list) and store the string, setting its count file to 1 ( since there has been an occurrence). You will need head_insert, either as a member function or a utility to add the values to the list.

Hashing involves adding the ASCII codes for each value and then using remainder division to select the array index. The hash table insures even distribution of the variables for fast access. Note that the data will not be sorted.

The output of the program will be a printout of each linked list, starting at index zero. Print the variables plus the count of each.

The algorithm will be discussed in more detail in class. You will need a search yielding a pointer to update the count field when a variable is present. Further specifications will be given if needed.

INPUT: File containing strings representing variables.

OUTPUT: As described above.

TO HAND IN:

Hardcopy of the C++ Code.
Hardcopy of the output
Your recording device

SPECIFICATIONS for the HASH FUNCTION:
output type: int
input type: a string or cstring
algorithm: sum the ASCII code for the string and return the sum modulo the size of the array. Ignore overflow when doing the sum.

Data for program 4

educe
line
educe
primrose
depart
line
thwart
line
grand
cellular
line
educe
depart
manage
depart
headline
empire
torch
headline
line
myth
deposit
balance
cellular
educe
distance

SPECIFICATIONS for PROGRAM

For the node class, add the following:

Private member
string word
two functions, a transformer and observer for the new private member
modify the constructor for the new data member

For the bag class
Public:
The “Big Four”, constructor, copy constructor, destructor, overloaded =.

bool search_list
// tells the client wheather a specific value is in the list. Calls a function search.

void head_insert
//should be a member function rather than a utility.

void add_to_count
//access the “current” pointer (in the private section)
//to update the count field of the node if the search is successful

friend ostream operator << (ostream &, const bag & mylist)
//prints a linked list.
//Overloaded operator to print both the data and the count field for each node.

Protected:
node * search1_list
//Called by the public function search_list.
//Sets the private memebr current to the node to be updated
//or is NULL if the value is not there.

Private:
node * head_ptr;
node * current;
//add to the bag class. This pinter will be used in the search
//and again used to update the node if the data is already present.

In The Main Program

The main should have an EOF loop and a two-way decision to decide whether
to update the count field or add a new node to the head of the list.

Print the list in the main after the EOF loop. (the output will not be sorted)

The call to the output operator is as follows:
out4<<hashtable[i]//out4 is an ofstream object

Suggestion: code the program at first with a single, linked list, then add the hash table.

csc 210 2011 04 20

Posted in csc210 by bnmng on 2011 04/20

Random notes about Program 4:
Hash function will see a string coming in. Doesn’t know anything about a class.
Sample Test given out today. Program 4 interfaces with an array of classes.

Final on the 4th at 5:00. One on exceptions, one on recursion.

Today: HW 9, sample test & inclass ex for recursion.

phi101 2011 04 20 Notes

Posted in phi101 by bnmng on 2011 04/20

Finals Wed, May 4, at 10:00.

csc210 2011 04 18 Notes

Posted in csc210 by bnmng on 2011 04/18

Tonight: Homework 8 then Chapter 18.
Recursion. Finish what we need to cover for the semester.
Simple Types
Arrays
Linked List

HW 9 is due Wed the 20th.
Lab Mon 25th
Final May 4th.
Wed the 27th and May 2 free.

Probably can adapt Program 2 for Program 4.

csc210 20110413 Notes

Posted in csc210 by bnmng on 2011 04/13

Homework Monday and Wednesday, Lab 25th. Week 15 free.

Final, earliest possible Wed the 4th, during class time.
Program due during final exam.

Free class Wed 27, Monday May 2nd.

Read 18.2 – 18.6
Skip 18.3

Today, Test 3
Exceptions
Recursion

Program: A simple linked list. You can modify Program 2’s linked list.

The node will look like this:

Name Field: These will be the names for our variables.
Count FIeld
Link Field

If it’s there, update the count. If not, add it.

The decision of whether or not to add a node should be in the main.

Hash Table:
0 __
1 __->__
2 __
3 __->__
4 __
can be an array of classes or pointers. Compilers don’t

Exception Handling using Try and Catch.

Page 837 illustrates levels of throws.

Next time: Recursion.

csc205 20110412 Notes

Posted in csc205 by bnmng on 2011 04/12

Test Next Week.

Today: Calculator, Homework, and in-class.

Study Notes: Think about the padding for negative numbers.
Remember, you have to know the size of your data elements when traversing an array.

Remember, push down pop-up.