Programming, Block C http://www.win.tue.nl/˜wstomv/2ip05/ Lecture 15 Tom Verhoeff Kees Hemerik Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering & Technology Feedback to T.Verhoeff@TUE.NL
c 2007, T. Verhoeff @ TUE.NL 1 Programming, Block C: Lecture 15
Today’s Topics
- Branching dynamic data structures with pointers:
– Trees – Binary Trees (BTs) – Binary Search Trees (BSTs)
- More recursion
c 2007, T. Verhoeff @ TUE.NL 2 Programming, Block C: Lecture 15
Linear Structures: Linked Lists
- Storage overhead : 1 or 2 pointers per cell
Single-linked versus double-linked (bi-directional)
- Access/modification time : worst-case proportional to list length
Linear in the actual size: O(N) How to improve the worst-case time for operations?
c 2007, T. Verhoeff @ TUE.NL 3 Programming, Block C: Lecture 15
Branching Structures: (Binary (Search)) Trees In computing, trees are everywhere
- Syntax trees
7 3 2 5 11 A B C E D F
– –- Directory trees
- Widget trees
- Search trees
- . . .
c 2007, T. Verhoeff @ TUE.NL 4 Programming, Block C: Lecture 15