Work Note 7, DM803, fall 2016

Exercises October 24

  1. Consider the data structures covered in the course. Which can be made partially persistent using the node-copying method from [DSST89]?
  2. Try the method from [DSST89] on a singly-linked list. The list must be kept sorted and there is one access pointer (to the first element in the list). Insert the elements (in that order): 1, 5, 9, 2, 3, 4, 8, 7, 6. Then delete: 5, 4, 3, 2, 1, 7, 8, 9, 6. Change version after each update (19 versions in total). Assume that there is one extra pointer. We will not need copy or inverse pointers. [We will not necessarily cover all of this in class.]
  3. Assume we have a singly-linked list of length n. We now repeat indefinitely: change to new version and make a change in the last element of the list. How often is the first element of the list copied using the method from [DSST89]? Assume that there is one extra pointer.
  4. Show that if there are fewer extra pointer fields than the number of inverse pointers, then the method from [DSST89] may use time which is not amortized constant per update.
  5. Again without copy or inverse pointers and just one extra field try working with binary trees. From an empty tree, insert E, C, M, O, A, I, G, K, J (the ordering is lexicographic) and then delete M, E, A. Change version after each insertion or deletion. When deleting a key in a node with two nonempty children, physically delete the node containing the largest key smaller than the key to be deleted.
  6. Sketch an example where the copy pointer is needed.
  7. Sketch an example where inverse pointers are needed.

Lecture October 27


Last modified: Thu Oct 13 09:31:03 CEST 2016
Kim Skak Larsen (kslarsen@imada.sdu.dk)