29
Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

Embed Size (px)

Citation preview

Page 1: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

Institut für Kartographie und Geoinformation

Diskrete Mathematik IVorlesung 6

18.11.99

-Bäume-

Page 2: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

2

Übersicht

• Eine neue rekursive Datenstruktur: Bäume– Der Binäre Baum– Binärer Suchbaum

• Definition• Beispiel

Page 3: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

3

Der Binäre Baum

• Ein leerer Baum ist ein binärer Baum• Sind L und R zwei binäre Bäume und w ein Knoten

mit dem Inhalt n, dann ist die Verknüpfungvon w, L und R ein binärer Baum.

n

L R

Page 4: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

4

Binärer Suchbaum

• Ein binärer Baum B ist ein binärer Suchbaum, falls er leer ist oder die folgenden Eigenschaften erfüllt sind:

– die beiden Unterbäume sind binäre Suchbäume– die Beschriftungen der Knoten des linken Suchbaums sind

kleiner als die Beschriftung der Wurzel– die Beschriftungen des rechten Suchbaums sind größer als

die Beschriftung der Wurzel

n

<n >n

Page 5: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

5

9 4 17 13 2 23 7

Binärer Suchbaum

Aufbau eines binären Suchbaums aus folgenden Elementen:

Page 6: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

6

4 17 13 2 23 79

Page 7: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

7

17 13 2 23 7

9

4

Page 8: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

8

4 < 9

17 13 2 23 7

9

Page 9: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

9

4

17 13 2 23 7

4

9

Page 10: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

10

13 2 23 7

4

9

17

Page 11: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

11

17 > 9

13 2 23 7

4

9

Page 12: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

12

17174

9

13 2 23 7

Page 13: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

13

2 23 7

174

9

13

Page 14: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

14

13 > 9

2 23 7

174

9

Page 15: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

15

13 < 17

2 23 7

174

9

Page 16: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

16

13

2 23 7

13

174

9

Page 17: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

17

23 7

13

174

9

2

Page 18: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

18

2 < 9

23 7

13

174

9

Page 19: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

19

24 >

23 7

13

174

9

Page 20: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

20

2

23 7

2 13

174

9

Page 21: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

21

7

2 13

174

9

23

Page 22: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

22

23 > 9

7

2 13

174

9

Page 23: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

23

23 > 17

7

2 13

174

9

Page 24: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

24

23

7

232 13

174

9

Page 25: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

25

232 13

174

9

7

Page 26: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

26

7 < 9

232 13

174

9

Page 27: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

27

1774 <

232 13

174

9

Page 28: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

28

77 232 13

174

9

Page 29: Institut für Kartographie und Geoinformation Diskrete Mathematik I Vorlesung 6 18.11.99 -Bäume-

Schönen Dank für Ihre Aufmerksamkeit und

Auf Wiedersehen