Name: ____________________________________________________ Alpha: _____________ Section: ________

Describe help received: _________________________________________________________________

See the bottom for how to submit your work.

Due: Before 0800 on next class day

  1. (10 pts) Read today's lecture notes. Honestly declare how you read the notes.
    1. (10 pts) I read the notes carefully. I have a good understanding of the topics therein.
    2. (10 pts) I read the notes carefully, but I don't really understand the following points well:
      
      
      
    3. (0 pts) I didn't read the notes carefully.
  2. [10pts] We have variables L and t, both of type Node*, with the values depicted in the figure below:
    
    struct Node
    {
      int data;
      Node* next;
    };
    

    The definition of struct Node is given above too. Write statement(s) that perform the following. Note: each problem is independent, meaning that changes in one part are not carried forward into the next part.

    1. Change the 8 to a 13:
      
      
      
      
      
    1. Change the 2 to a 6:
      
      
      
      
      
    1. Add to the front of the list L the node that t points to; i.e. after these statements, L should point to the list 5,8,2,7. Warning: Don't create any new node!
      
      
      
      
      
      
  1. [10pts] Consider the following code:
    
    struct Node
    {
      string data;
      Node* next;
    };
    
    int main()
    {
      Node* temp = new Node;
      temp->data = "world";
      temp->next = NULL;
    
      Node* List = new Node;
      List->data = "Hello";
      List->next = temp;
    
      return 0;
    }
    
    Draw a picture that depicts the code (like the picture in problem 2):
Bring to class