CPS 100E, Fall 1996 Inlab 6
Name:
Lab Section:
You should answer the following questions and either
turn in the sheet during lab, or answer the questions
when you submit your README file.
These questions are worth 2 out
of the 10 points for each lab. You don't need to get all
the answers right to get the 2 points, but you must try.
It's ok to ask a UTA or TA for help, but first you must
try to find the answers on your own.
-
In the class StockList there is a member function
named~StockList. This is the destructor. What is the
destructor for?
-
The line below constructs a new StockNode
StockNode * newNode = new
StockNode(symbol, exchange, price, volume, volatility, name);
Is is posible to define a new node using the statement below without
giving any values to the fields of the StockNode? Why?
StockNode * newNode = new StockNode;
-
Why does the function Current return a
Stock & rather than a Stock?
-
If there are N elements in a linked list that is sorted
alphabetically, approximately how many comparisons are needed to
determine that an element is not in the linked list? How many comparisons
are needed if the list is not sorted? Express your answers
in terms of N.
- The function below is one of the StockList constructors.
StockList::StockList()
: myList(STOCK_VECTOR_SIZE,0),
myCount(0),
myBucket(0),
myCurrent(0)
{ }
What purpose does the 0 after STOCK_VECTOR_SIZE serve?