COP3530- Data Structures Advanced Lists Dr. Ron Eaglin
Objectives Describe Different List Implementations and Purposes Circular Lists Skip Lists Self Organizing Lists Move to Front Method Transpose Method Count Method Ordering Method Sparse Tables
Circular List Tail
Circular List Can be implemented singly or doubly linked Useful in application where “turns” are done in rotation Like a game where users take turns Used in time sharing problems (determine which user/process) has time allocation
Skip Lists
Skip Lists Nodes have pointers to multiple nodes further down the list Simple sample design – add pointer at 1, 2, 4, 8, 16 All nodes have one pointer ½ nodes have 2 pointers ¼ nodes have 3 pointers Etc… Can create more efficient search algorithm
Sorted Skip List (Search Example) Find G – 3 tries vs. 7 A E I C G B D F H A E I C G B D F H
Skip Lists Very similar conceptually to Binary Trees Used in many database designs
Self Organizing Lists Move to Front – When the desired element is located it is moved to the beginning of the list. Transpose – When the desired element is located, swap it with its predecessor Count – Order the list by the number of times the element is accessed Other – use judgment, external algorithm to determine ordering method.
Advantages to Ordering If most accessed element is near front of list – number of operations to find it are minimized.
Sparse Tables A sparse table is a table where most of the cells are empty Can be implemented as a Linked List where each element in the first Linked List is a Linked List
Sparse Table 1 2 3 4 5 6 7 8 9 A R N W C S Z F Q
Sparse Table L1 (A, R), L2 (N, W) , L3( C ), L5 (S, Z, A), L7(F), L8 (Q, C ), L9 (W) More efficient use of memory and resources
Objectives Describe Different List Implementations and Purposes Circular Lists Skip Lists Self Organizing Lists Move to Front Method Transpose Method Count Method Ordering Method Sparse Tables