notes09 - CSE 2320 Notes 9: Linked Lists (Last updated...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE 2320 Notes 9: Linked Lists (Last updated 10/6/11 8:11 PM) Sedgewick 3.3, 2.6, 12.3, 3.5, 3.4 9.A. S INGLY- LINKED ( FORWARD ) L ISTS . Links may be: Pointers Subscripts Disk addresses Web URLs (a logical address vs. a physical address in the other three cases) If the nodes have a key (i.e. a dictionary), should the list be ordered (ascending) or unordered? Ordered: If node y is the physical successor of x , then y is the logical successor of x . Unordered: No relationship between adjacent nodes. ASSUMPTION: Uniform access probabilities equal likelihood for accessing each of n keys expected probes hit miss unordered ordered n + 1 2 n + 1 2 n + 1 2 n 1 + 2 + + n n = n n + 1 ( ) 2 n = n + 1 2 Most applications have many more hits than misses. Many applications, however, need ordered retrieval (L OGICAL S UCCESSOR , L OGICAL P REDECESSOR ). 2 9.B. K EEPING L INKED L IST C ODE S IMPLE AND E FFICIENT . a. Header dummy node at beginning of list (even if no other nodes). Avoids first node special cases: D ELETE U NION This pointer never changes Can be wasteful if an application needs large number of very short lists. b. Sentinel dummy element at end of unordered table, unordered list, or tree....
View Full Document

Page1 / 6

notes09 - CSE 2320 Notes 9: Linked Lists (Last updated...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online