

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Fall 2007
Samet
if ptr2 6 = λ then begin if ptr1 6 = λ then NEXT(ptr1) ↔ NEXT(ptr2); ptr1 ← ptr2; ptr2 ← λ; end;;
What happens if both ptr1 and ptr2 point to nodes in the same circular list?
0 1 4 6 16 20 24 28 2 3 5 7 17 21 25 29 8 9 10 11 18 22 26 30 12 13 14 15 19 23 27 31
What is the access function for element A[i, j] assuming a 2a^ × 2 b^ array where a and b differ by at most one and that the first element is A[0, 0] and is located at location 0? The key to determining the location at which A[i, j] is stored is to determine the expansion step m at which A[i, j] was allocated (i.e., which doubling step). In particular, you must distinguish between even and odd doubling steps (i.e., m = 2k or m = 2k + 1). For example, element A[1, 2] is allocated in the third doubling step (i.e., m = 3) at which time elements 4–7 (i.e., A[0, 2], A[1, 2], A[0, 3], A[1, 3]) were allocated, while element A[2, 2] was allocated in the fourth doubling step (i.e., m = 4) at which time elements 8–15 (i.e., A[2, 0], A[2, 1], A[2, 2], A[2, 3], A[3, 0], A[3, 1], A[3, 2], A[3, 3]) were allocated. Your answer should be in terms of i, j, and k.