Chris Pollett > Old Classes > PIC10B Lec 1&2 ( Print View ) Lecture Notes-PDF. Enrollment info. Course Info:
Practice Exams: PIC: |
Fall 2000 PIC 10b Practice Final
The final is Sunday, Dec 10 3-6pm in Moore 100.
The real final will have seven problems of equal value and should be about
the same difficulty. One problem from the practice final is guaranteed
to be on the actual final.
1. Define the following terms:
(a) FILO
(b) tail recursion
(c) memoization
(d) external node
(e) adaptive sorting
2. Write a function with prototype:
template<class Item>
Node<Item>* reverse(Node<Item>* list);
to reverse a linked-list where the Node's
class is:
template <class Item>
class Node
{
public:
Node(Item i, Node* n){item=i; next=n;}
void setItem(Item i){item =i;}
void setNext(Node* n){next=n;}
Item getItem(){return item;}
Node* getNext(){return next;}
private:
Item item;
Node* next;
};
3. Briefly explain why the first version of insertion sort we described
in class was non-adaptive and why it runs in time
|