CS140: Homework 9

  1. The splay tree portion of this homework was given in the labs.

  2. You are given the following declarations for a doubly linked list:
         struct node {
             struct node *next;
             struct node *prev;
             int value;
         };
    
         struct node *my_node;
    
    1. Suppose you are given the following information:
           my_node = 0x48
           my_node->next = 0x58
           my_node->prev = 0x38
           my_node->value = 20
           my_node->prev->prev = 0x28
           my_node->prev->value = 28
           

      Draw the memory diagram for my_node and its predecessor node. In particular, label the boxes in the following diagram with the appropriate hexadecimal addresses and in each box either indicate the name of the field and the value stored at that memory location or leave the box blank if the contents at that memory location are unknown.

                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------
                           |                              |
                           |                              |
                           --------------------------------