Insert same as unsorted array structure no loops 6

This preview shows page 24 - 31 out of 62 pages.

Insert (same as Unsorted Array Structure) No loops, 6 memory accesses, O(1) Fetch The loop in the sequential search executes an average of n/2 times, with 3 memory accesses each time, O(n) Delete Loop in the sequential search executes an average of n/2 times, with 3 memory accesses each time, O(n) Update Combines a Delete and Insert Operation, 1.5n+6 memory accesses, O(n) Average operation: 1.125n + 3 memory accesses, O(n)
Image of page 24

Subscribe to view the full document.

25 Density Of A Singly Linked List Density = information bytes / total bytes Information bytes = n * w n is the number of nodes, w is the bytes per node Overhead = 4(1 + 2 + 2n) bytes (for ref. variables) 4 bytes per variable * (Header + dummy node + linked nodes) Density = n * w / (n * w + 4(1 + 2 + 2n) ) = 1 / (1 + 12 / (n*w) + 8 / w) As n gets large above approaches 1 / (1 + 8 / w)
Image of page 25
26 Variation In Density Of A Singly Linked List With Node Width Density of a Singly Linked List for n >= 100 nodes 0 0.2 0.4 0.6 0.8 1 0 20 40 60 80 100 Information bytes per node, w Density
Image of page 26

Subscribe to view the full document.