Sie sind auf Seite 1von 13

Rule based classifiers: technique for classifying records

using a collection of if/then rules. Table 5.1. Example of a rule


set for the vertebrate classification
r1: (Gives Birth = no) (Aerial Creature = yes) Birds
r2: (Gives Birth = no) (Aquatic Creature = yes) Fishes
r3: (Gives Birth = yes) (Body Temperature = warm-blooded)
Mammals
r4: (Gives Birth = no) (Aerial Creature = no) Reptiles
r5: (Aquatic Creature = semi) Amphibians
Rule antecedent(precondition): left hand side of the rule.
Rule consequent: right hand side of the rule, contains the
predicted class yi.
Mutually Exclusive Rules The rules in a rule set R are
mutually exclusive
if no two rules in R are triggered by the same record. This
property ensures
that every record is covered by at most one rule in R.
Exhaustive Rules A rule set R has exhaustive coverage if
there is a rule
for each combination of attribute values. This property ensures
that every
record is covered by at least one rule in R.
Ordered Rules In this approach, the rules in a rule set are
ordered in
decreasing order of their priority, which can be defined in many
ways (e.g.,
based on accuracy, coverage, total description length, or the
order in which
the rules are generated). An ordered rule set is also known as a
decision
list. When a test record is presented, it is classified by the
highest-ranked rule
that covers the record. This avoids the problem of having
conflicting classes
predicted by multiple classification rules.
Unordered Rules This approach allows a test record to trigger
multiple
classification rules and considers the consequent of each rule
as a vote for
a particular class. The votes are then tallied to determine the
class label
of the test record. The record is usually assigned to the class
that receives
the highest number of votes.
Rule-based ordering scheme: This approach orders the
individual rules
by some rule quality measure. This ordering scheme ensures
that every test
record is classified by the best rule covering it. A potential
drawback of this
scheme is that lower-ranked rules are much harder to interpret
because they
assume the negation of the rules preceding them.
Class-Based Ordering Scheme In this approach, rules that
belong to the
same class appear together in the rule set R. The rules are
then collectively
sorted on the basis of their class information. The relative
ordering among the
rules from the same class is not important; as long as one of
the rules fires,
the class will be assigned to the test record. This makes rule
interpretation
slightly easier. However, it is possible for a high-quality rule to
be overlooked
in favor of an inferior rule that happens to predict the higherranked class.
Rule-Growing Strategy There are two common strategies for
growing a

Representation compared to decision tree and rule-based


classifiers that are often constrained to rectilinear boundaries.
Nearest-neighbor classifiers can produce wrong predictions
unless the
appropriate proximity measure and data preprocessing steps are
taken.
For example, suppose we want to classify a group of people
based on
attributes such as height (measured in meters) and weight
(measured in
pounds). The height attribute has a low variability, ranging from
1.5 m
to 1.85 m, whereas the weight attribute may vary from 90 lb. to
250
lb. If the scale of the attributes are not taken into consideration,
the
proximity measure may be dominated by differences in the
weights of a
person.
Bayes Theorem: stat principle for combining prior knowledge of
the classes with new evidence gathered from data. Let X denote
the attribute set and Y denote the class variable. If the class
variable has a non-deterministic relationship with the attributes,
then we can treat X and Y as random variables and capture their
relationship probabilistically using P(Y |X). This conditional
probability is also known as the posterior probability for Y , as
opposed to its prior probability, P(Y )
Conditional Independence: An example of conditional
independence is the relationship between a persons arm length
and his or her reading skills. One might observe that people with
longer arms tend to have higher levels of reading skills. This
relationship can be explained by the presence of a confounding
factor, which is age. A young child tends to have short arms and
lacks the reading skills of an adult. If the age of a person is fixed,
then the observed relationship between arm length and reading
skills disappears. Thus, we can conclude that arm length and
reading skills are conditionally independent when the age
variable is fixed.
Characteristics: They are robust to isolated noise points
because such points are averaged out when estimating
conditional probabilities from data. Nave Bayes classifiers can
also handle missing values by ignoring the example during
model building and classification. They are robust to irrelevant
attributes. If Xi is an irrelevant attribute, then P(Xi|Y ) becomes
almost uniformly distributed. The classconditional probability for
Xi has no impact on the overall computation
of the posterior probability.
Ensemble or classifier combination methods: improving
classification accuracy by aggregating the predictions of multiple
classifiers. Constructs a set of base classifiers from training data
and performs classification by taking
a vote on the predictions made by each base classifier.
Rationale: Consider an ensemble of twenty-five binary
classifiers, each of
which has an error rate of = 0.35. The ensemble classifier
predicts the class
label of a test example by taking a majority vote on the
predictions made
by the base classifiers. If the base classifiers are identical, then
the ensemble
will misclassify the same examples predicted incorrectly by the
base classifiers.
Thus, the error rate of the ensemble remains 0.35. On the other
hand, if the
base classifiers are independenti.e., their errors are
uncorrelatedthen the
ensemble makes a wrong prediction only if more than half of the
base classifiers predict incorrectly.
Bagging: Bagging, which is also known as bootstrap

classification rule: general-to-specific or specific-to-general.


Characteristics of Rule-based classifiers: The
expressiveness of a rule set is almost equivalent to that of a
decision tree because a decision tree can be represented by a
set of mutually exclusive and exhaustive rules. Both rule-based
and decision tree classifiers create rectilinear partitions of the
attribute space and assign a class to each partition.
Nevertheless, if the rule-based classifier allows multiple rules
to be triggered for a given record, then a more complex
decision boundary can be constructed. Rule-based classifiers
are generally used to produce descriptive models that are
easier to interpret, but gives comparable performance to the
decision tree classifier. The class-based ordering approach
adopted by many rule-based classifiers (such as RIPPER) is well
suited for handling data sets with imbalanced class
distributions.
eager learners: designed to learn a model that maps the
input attributes to the class label as soon as the training data
becomes available. An opposite strategy would be to delay the
process of modeling the training data until it is needed to
classify the test examples. Techniques that employ this
strategy are known as lazy learners. Rote classifier, which
memorizes the entire training data and performs classification
only if the attributes of a test instance match one of the
training examples exactly. Drawback, this approach is that
some test records may not be classified because they do not
match any training example.
Nearest-Neighbor: Nearest-neighbor classification is part of a
more general technique known as instance-based learning,
which uses specific training instances to make predictions
without having to maintain an abstraction (or model) derived
from data. Instance-based learning algorithms require a
proximity measure to determine the similarity or distance
between instances and a classification function that returns the
predicted class of a test instance
based on its proximity to other instances. Lazy learners such as
nearest-neighbor classifiers do not require model building.
However, classifying a test example can be quite expensive
because we need to compute the proximity values individually
between the test and training examples. In contrast, eager
learners often spend the bulk of their computing resources for
model building. Once a model has been built, classifying a test
example is extremely fast.
Nearest-neighbor classifiers make their predictions based on
local information, whereas decision tree and rule-based
classifiers attempt to find a global model that fits the entire
input space. These classifiers can also produce arbitrarily
shaped boundaries, where such boundaries produce a more
flexible
Exclusive vs. Overlapping vs. Fuzzy

aggregating, is a technique that repeatedly samples (with


replacement) from a data set according to a uniform probability
distribution. Each bootstrap sample has the same size as the
original data. Because the sampling is done with replacement,
some instances may appear several times in the same training
set, while others may be omitted from the training set. Each
sample has a probability of (1-1/n)n of being selected.
Boosting: Boosting is an iterative procedure used to adaptively
change the distribution of training examples so that the base
classifiers will focus on examples that are hard to classify. Unlike
bagging, boosting assigns a weight to each training example and
may adaptively change the weight at the end of each boosting
round. Records wrongly classified have their weights increased.
Records classified correctly have their weights decreased.
Clustering:

Partitional Clustering: a division of the set of data objects into


clusters such that each data object is in exactly one subset.
Taken individually, each collection of clusters is a partitional
clustering.
Hierarchical Clustering: a set of nested clusters that are
organized as a tree. Each cluster within the tree(except for leaf
nodes) is the union of its children, and the root is the cluster
containing all objects.

Importance of choosing initial centroids(K-means): If the


centroids are randomly chosen, optimal clustering becomes
difficult, however solutions to choosing the centroids are as
follows: do multiple runs through the data; sampleand use
hierarchical clustering to determine initial centroids; select more
than k initial centroids and then select among these initial
centroids(selects most widely separated); use post processing
techniques; or bisect K-means.
Pre-Processing(K-means): normalize the data; eliminate
outliers.
Post-Processing(K-means): Eliminate small clusters that may
represent outliers; split loose clusters; merge clusters that are
close.
Strengths and Weaknesses(K-Means):

Prototype base clustering: (Well-Separated)Cluster is a


set of objects in which each obj. is more similar to the
prototype that defines the cluster than to the prototype of any
other cluster. (Center-based)For continuous data types, the
prototype of a cluster is often a centroid(mean) of all points in
the cluster. When using categorical attributes, prototype is
often a medoid(most representative point of a cluster

any point in a different cluster.


Density-based: A cluster is a dense region of obj. that is
surrounded by a region of low density. Helps clarify noise and
outliers. Often employed when clusters are irregular or
intertwined and when noise and outliers are present.

Chapter 3
Algorithm
A well ordered collection of unambiguous and effectively
computable operations that produces a result and halts in a
finite amount of time.
Enumeration Type
A type whose values are defined by a list of constants of type
int.
Chapter 4 and 5
Top-Down-Design
Break down the task to be accomplished into subtasks,
decompose each of these subtasks into smaller subtasks, etc. Also called "Stepwise refinement or divide and conquer."
Functions
-Value of a function is an argument.
-Function Call An expression consisting of the function name
followed by arguments enclosed in parentheses.
Type Cast
Changes an int into a double:
static_cast<double>(number/variable);
Function Declaration
-Describes how the function is called at the top of the program
before main(). Required to appear prior to the call to a function
whose definition has not yet appeared.
Call by Value
Argument values are plugged into the function's parameters.
Just the values, not the variables themselves. The formal
parameter is a local variable that is initialized to the value of
the corresponding argument.
Call-by-Reference
The argument variables are plugged into the functions
parameters, not the values. The argument variable is
substituted in for the formal parameter so that any change that
is made to the formal parameter is actually made to the
argument variable.
Black Box
Anyone who uses a function should not be required to know the
contents of the functions to see how it works, but rather that it
will do what it is meant to do when called.
-Also called "information hiding".
-Writing and using functions as if they were black boxes is also
called "procedural abstraction."
Void Functions
Used when you want the program to output some results of a
calculation, but not to return a value for the rest of the program
to use.
Formal Parameters
For a function are listed in the function declaration and are used
in the body of the function definition. It is a blank placeholder
that is filled with something when the function is called.
Precondition
States what is assumed to be true when the function is called.
Postcondition
Describes what the function actually does.
Chapter 10
Structure
An object without any member functions. Though it carries
member variables and can hold data values.
Member Variables
Specified by giving the name of the structure variable followed
by a period, then the member name. ex: account.balance.
Class
A data type who variables are objects. Each object as a variable
has member functions, as well as the ability to hold data values.
Scope resolution operator
Used to tell what a member function is a member of. ex.
DayOfYear::output().
An accessor function for a member variable is a non-void
function that returns a member variable

// Constructors //
int main()
{
Cat myCat;
cout << "My cat is "
<< myCat.getState()
<< endl;
cout << "What is the cat's name?" << endl;
string name;
cin >> name;
// In main
myCat.setName(name);
// Name in the cat
object
Cat cat2("whiskers", "tabby", "eating");
Cat anotherCat("Chairman Meow", "Siamese", "plotting");
anotherCat.attack(cat2);
cout << anotherCat.getName() << " is " <<
anotherCat.getState() << endl;
cout << cat2.getName() << " is " << cat2.getState() <<
endl;
//cat2.name = "Captain Whiskers";
public

// Legal only if name is

cat2.setName("Captain Whiskers");
system("pause");
return 0;
}
Cat::Cat()
// Default constructor
{
state = "sleeping";
name = "Snowball";
breed = "stray";
}
Cat::Cat(string aName, string aBreed, string init)
{
state = init;
name = aName;
breed = aBreed;
}
// Functions for class //
void Cat::startEating()
// Scope resolution operator: "::"
{
state = "eating";
}
void Cat::setName(string aName)
{
name = aName;
}
string getName()
{
return name;
}
void Cat::attack(Cat target)
{
state = "attacking";
target.state = "defending";
}
// Default for class is PRIVATE

The body of a mutator function contains one or more


assignment statements, that assign value(s) to member
variable(s).
Accessor functions and mutator functions are
sometimes called "getter" and "setter" functions.
A broader definition of accessor and mutator functions
says any function that uses but does not change a member
variable is an accessor function (an output function would fall
into this category). And any function that modifies the value of
any member variable while performing some task (such as
reading input) is a mutator function. More common usage limits
accessor functions to returning a member variable and mutator
functions to simple assignments to member variables.

Struct example
struct CDAccount
{
double balance;
double interest_rate;
int term;
};
void get_data(CDAccount& the_account);
int main()
{
CDAccount account;
get_data(account);
double rate_fraction, interest;
rate_fraction = account.interest_rate / 100.0;
interest = account.balance * rate_fraction * (account.term /
12.0);
account.balance = account.balance + interest;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << "When your CD matures in "
<< account.term << " months,\n"
<< "it will have a balance of $"
<< account.balance << endl;
}
void get_data(CDAccount& the_account)
{
cout << "Enter the account balance: $";
cin >> the_account.balance;
cout << "Enter account interest rate: ";
cin >> the_account.interest_rate;
cout << "Enter the number of months until maturity\n"
<< "(must be 12 or fewer months); ";
cin >> the_account.term;
}
Class Example
class DayOfYear
{
public:
void output(); //Member function declaration
int month;
int day;
};
int main()
{
DayOfYear today, birthday;
cout << "Enter today's date:\n ";
cin >> today.month;
cout << "Enter the day of the month: \n";

// Default for struct is PUBLIC

Switch Example
int main()
{
char grade;
cout << "Enter your midterm grade and press Return: ";
cin >> grade;
switch (grade)
{
case 'A':
case 'a':
cout << "Excellent. "
<< "You do not need to take the final." << endl;
break;
case 'B':
case 'b':
cout << "Very good. ";
grade = 'A';
cout << "Your midterm grade is now " << grade
<< endl;
break;
case 'C':
case 'c':
cout << "Passing. ";
break;
case 'D':
case 'd':
case 'F':
case 'f':
cout << "Not good. "
<< "Go study." << endl;
break;
default:
cout << "That is not a possible grade." << endl;
}
cout << "End of program." << endl;
Descending Stars
Int num;
cin >> num;
for(int i = num; i >= 1;i--)
{
for(int j = 1; j <= i; j++)
{
cout << "*";
}
cout << endl;
}
Print 1-100 divisible by n
for(int i = 0;i <= 100; i++)
{
if((i%4 == 0) && !(i%3 == 0))
{
cout << i << endl;

cin >> today.day;


cout >> "Enter your birthday: ";
cin >> birthday.month >> birthday.day >> endl;
// etc
cout << today.output(); //Calls member function
cout << birthday.output(); //Calls member function
}
void DayOfYear::output()
{
cout << "month = " << month
<< "day = " << day << endl;
}
Ascending Stars
int num;
cin >> num;
for(int i = 1; i <= num; i++)
{
for(int j = 1; j <= i; j++)
{
cout << "*";
}
cout << endl;
}

Chapter 6: I/O
Opening a file: in_file.open("file.dat"); or declare the file to
open as a string and use cin>> and convert to a c_str(). With
in_file.open(file.c_str());
.setf(ios::fixed); : uses fixed point rather than exponential
.setf(ios::showpoint); : show decimal point
Manipulators: apply only to the next item; use #include
<iomanip>
-Streams may be passed as an argument to a void input
function; must be passed by reference
Extraction operator ">>": skips whitespace characters; can
use a loop to pick up all numerical data.
in_stream.get(next): reads one character and advances
position in stream
out_stream.put(char. expression): writes one character to
the stream
getline(in_file, next): reads entire line.
eof(): use a loop to read the entire file; while(! in_file.eof())
-Don't use eof() with numeric data
-Dont use >> with text data
Inheritance: a child class inherits member functions from its
parent; while a child class can have its own unique member
functions
Object: variable that has functions associated with it.
Class: a type whose variables are objects
ifstream , ofstream are examples of classes.
Chapter 7: Arrays
Array declaration: char name[5]; or int score[5] =
{1,2,3,4,5}; int score[] = {1,2};
Indexed variables: the individual variables that make up an
array.
Contiguous storage: One double takes up 8 bytes of storage;
double list[5] will use 40 consecutive bytes of memory storage
-cin >> list[5] is illegal.
-Passing an array in a function ex: void doubler(double a[],
int size);
doubler(list, 5); arrays are always passed to a function using
pass by array
-Array parameters are always passed by reference; if you
do not want the array to change, use const; ex: void
change(const int a[], int size)
Declaring 2d array: array1[2][6] = 7; Saves 7 as the spot in
that array grid.
-char arrays can use << or >>

}
}
Ascending Numbers
int i = 1;
do{
cout << i << endl;
i++;
}while(i <= 100);
for(int i = 1;i <=100;i++)
{
cout << i << endl;
}
FizzBuzz
for(int i = 0;i <= 100; i++)
{
if((i%3 == 0) && (i%5 == 0))
{
cout << "FizzBuzz" << endl;
}
else if(i%3 == 0)
{
cout << "Fizz" << endl;
Chapter 11: Friend Functions
Operator overloading function declaration:
friend bool operator == (const patient& one, const
patient& two);
Why is this done: So you dont necessarily need to call any
accessor functions to find data from the parameter since the
overloaded operator is a member of the class and has full
access to all private data.
Header: bool operator == (const patient& one, const patient&
two)
-The operator is a friend of the patient class; declaration
appears in the class definition, though in the header there is no
scope resolution operator, or mention of the class itself.
Rules for operator overloading or restrictions:
-Cannot create new symbols; cannot change the number of
arguments; cannot change precedence; at least one parameter
must be a class type; cannot overload (::) scope resolution or (.)
dot operator.
Overloading extraction operators:
Declaration: friend ostream& operator <<(ostream& outs,
const patient& one);
Algorithm
A well ordered collection of unambiguous and effectively
computable operations that produces a result and halts in a
finite amount of time.
Examples
Check to make sure file opens
file_in.open(in_file_name);
if (file_in.fail())
{
cout << "Input file opening failed." << endl;
exit(1);
}
Loop to get files from ifstream
getline(fin, bank_name);
getline(fin, account_num);
fin >> balance;
while (! fin.eof())
{
fin >> next;
if (fin.eof())
break;

-Classes can have array member variables or arrays with


a base type that is a class.
Chapter 8: Strings and Vectors
\O: The special end of string marker. It is an array of type char;
The \O is also referred to as the null character. It is used to
terminate a string.
strcpy("ABCDEF");: Copies one string into another; though if it
is too long, it will wipe out memory locations; it does not check
to make sure the variable the string is being assigned to copy to
is large enough to hold the value
Concatenate: strcat(cstring1, cstring2): adds cstring2 to
the end of cstring1; does not check to see if the concatenation
will overload the memory of the variable it is being assigned to.
strlen(source_string): returns an int equal to the length of
the string
strcmp(string1,string2): returns 0 if string1 and string2 are
the same; returns a value < 0 if they are not the same; returns
a value > 0 if string1 is > string2. The order is lexicographic.
clear(): erases everything in a string
length(): returns the length of the string
at(i): returns the character at index i
find(substring): returns index of first occurrence of substring
in calling string
atoi: this function converts a c-string to an int
atof: this function converts a c-string to a double
-Both require #include <cstdlib>
-Using an open statement, you must convert a string to a
c-string
-instream.open(filename.c_str());
Vectors: Like a 1-D array but can grow as needed; do not need
to make a predefined size and elements are all of same type;
need to #include <vector>
Chapter 11: Friend functions
Friend Function: Is not a member function of a class, but has
access to the private member variables of that class, just as a
member function does; the definition of the friend function goes
within the class definition
-Declaration: friend bool equal3(patient one, patient
two);when the function is implemented there is not class name,
scope resolution operator and the word friend does not appear
in the header.
-Rule of thumb
-If the function is related to a single object, use a member
function
-If two or more objects should be treated symmetrically use
a friend function.
Call by value: temporary copy of data; changes are made to
the copy and do not persist.
Call by reference: passes the address of the only copy;
changes are permanent
-To protect an object: use const; void myfunction(const
patient& one); Once you use const for an object parameter, you
must always use it.
Reading in scores from a data file to an array
#include <iostream>
#include<fstream>
int main()
{
int i = 0, array[10], max(0),avg(0);
ifstream in_stream;
in_stream.open("in_file.txt");
if(in_stream.fail())
{
cout << "Opening failed." << endl;
exit(1);
}
For(int i = 0; i < 10; i++)
{ instream >> array[i];}

fin >> total;


if (next == 'C')
{
checks++;
total_C += total;
}
else
{
deposits++;
total_D += total;
}
}
Array example
int i, temp[10];
for(int i = 0; i < 10;i++)
temp[i] = 2 * i;
for(int i =0; i < 10;i++)
cout << temp[i] << endl;
for(int i = 0; i < 10;i++)
cout << temp[i] << " ";
Output: 0,2,4,6,8,10,12,14,16,18
0,4,8,12,16
String Fun
int main()
{
int i;
// Declare two string variables
string firstName, lastName;
// Initialize using 'cin'
cout << "Enter your first name: ";
cin >> firstName;
cout << endl << "Enter your last name: ";
cin >> lastName;
// Output full name
cout << endl << endl;
cout << "Your name is " << firstName << " " <<
lastName;
cout << endl << endl;
// Output information about names
cout << " There are " << firstName.length() <<
" letters in your first name!" << endl;
cout << " There are " << lastName.length() <<
" letters in your last name!" << endl;
cout << endl;
cout << "Your name is spelled: " << firstName.at(0);
for (i = 1; i < firstName.length(); ++i)
{
cout << " - " << firstName.at(i);
}
cout << endl << endl;
cout << " Your 2 letter initials are: " <<
firstName.at(0) << lastName.at(0) << endl;
if ( firstName != lastName )
cout << " You have different first and last
names!";
else
cout << " You have the same first and last
names!";
cout << endl;
if ( firstName < lastName )
cout << " Your first name comes before your
last in the dictionary.";
else

Max = array[0];
For(int i = 0; i < 10; i++)
{
if(array[1] > max)
Max = score[i];
}
For(int i = 0; i < 10; i++)
{
Sum = array[i] + sum;
}
Double avg = 0;
Avg = sum/10.0;
Cout << sum << endl;
Cout << avg << endl;
Cout << max << endl;
Passing an array in a function
int list[5];
void doubler(double a[ ], int size)
{
for (int i = 0; i < size; i++)
{
a[i] = 2*a[i];
}
}
// to call:
doubler(list, 5);
Ascending Stars
int num;
cin >> num;
for(int i = 1; i <= num; i++)
{
for(int j = 1; j <= i; j++)
{
cout << "*";
}
cout << endl;
}
Descending Stars
Int num;
cin >> num;
for(int i = num; i >= 1;i--)
{
for(int j = 1; j <= i; j++)
{
cout << "*";
}
cout << endl;
}
Ascending Numbers
int i = 1;
do{
cout << i << endl;
i++;
}while(i <= 100);

Ch.13 Nodes and Linked Lists


Arrow operator: combines the actions of the dereferencing
operator "*" and a dot operator. Ex: head->count = 12;
Linked List: A linked list is a list of nodes in which each node
has a member variable that is a pointer that points to the next
node in the list. With the first node in the list as head.
Empty List: An empty list with nothing in it. To specify an

cout << " Your last name comes before your


first in the dictionary.";
cout << endl;
// Save first name and full original name.
string firstNameSave = firstName;
string fullNameOld
= firstName + " " + lastName;
// Change first name to be same as last
firstName = lastName;
// Output old full name and new full name
cout << endl;
cout << "Your old name was " << fullNameOld << endl;
cout << "Your new name is " << firstName << " " <<
lastName;
cout << endl << endl;
if ( firstName != lastName )
cout << " You have different first and last
names!";
else
cout << " You have the same first and last
names!";
cout << endl;
cout << endl << "Hmmm...let's fix up this name a
little..."
<< endl;
// Insert "ABC" after the first letter of your first name
firstName = firstName.insert( 1, "ABC" );
// Replace the first letter of the last name
lastName.at(0) = 'X';
// Append " mickeymouse" to the last name
lastName += " mickeymouse";
cout << " Your new crazy name is: " << firstName + "
" +
lastName << endl << endl;
// Extract a substring from firstName
cout << " The second, third and fourth letters of
your first name are " <<
firstName.substr( 1, 3 ) << endl;
// Let's erase your new first name
firstName.erase();
cout << " Bet you didn't like your new first name,"
" so let's erase it!" << endl;
cout << " Your first name is now: " << firstName <<
endl << endl;

empty list, you use the pointer NULL. Just set head = NULL;
Iterator: A construct that allows you to cycle through the data
items stored in a data structure so that you can perform
whatever action you want on each data item.
Ex: Node_Type *iter;
for( iter = Head; iter != NULL; iter = iter->link)
cout << (iter->data);
Stack: A data structure which is LIFO(Last in first out).
Queue: A stack/data structure which is FIFO(First in First out).
Ch. 14 Recursion
Stack overflow: An error message which signifies that some
function call has produced an excessively long chain of
recursive calls. It means the stack has reached its maximum
size with the memory allocated for it.
Ch. 15 Inheritance and Polymorphism

Das könnte Ihnen auch gefallen