1 |
h05 |
CS24 F19 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h05: Chapter 9: Recursion
ready? | assigned | due | points |
---|---|---|---|
true | Wed 10/23 12:00AM | Fri 11/01 11:59PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
INSTEAD OF TURNING IN THIS HOMEWORK, YOU WILL TAKE A QUIZ ON GAUCHOSPACE BY THE DUE DATE.
There is NO MAKEUP for missed homework assignments.
The quiz will be made available at least two days before the due date.
Please:
- No Staples.
- No Paperclips.
- No folded down corners.
Complete your reading of Chapter 9 (If you don’t have a copy of the textbook yet, there is one on reserve at the library under “COMP000-STAFF - Permanent Reserve”).
-
1. (15 pts) Consider the following definition of a doubly linked-list.
class LinkedList{
public:
LinkedList():head(0), tail(0){}
~LinkedList();
void reverse();
//reverses the order of elements in the linked list
void insert(int value);
private:
struct Node{
int data;
Node* next;
Node* prev;
};
Node* head;
Node* tail;
//Add your helper function here that recursively reverses the order of elements in the linked list
};