Chapter
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

Chapter 9 “ Tree graphs ” PowerPoint PPT Presentation


  • 71 Views
  • Uploaded on
  • Presentation posted in: General

Chapter 9 “ Tree graphs ”. Tree. it is graphs it have edeges and vertices but has no cycles. Traversal Tree There are 3 standard ways of traversing a tree with root R. In order traversal. Pre order traversal. Post order traversal. example: Apply traversal to print the tree:. a. b.

Download Presentation

Chapter 9 “ Tree graphs ”

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Chapter 9 tree graphs

Chapter

9

“Tree graphs”


Chapter 9 tree graphs

Tree

it is graphs it have edeges and vertices but has no cycles


Chapter 9 tree graphs

Traversal Tree

There are 3 standard ways of traversing a tree with root R.

In order traversal

Pre order traversal

Post order traversal


Chapter 9 tree graphs

example:

Apply traversal to print the tree:

a

b

c

d

e

f

g

h


Chapter 9 tree graphs

solution:

  • (1) In order traversal:

Left : h d b e .Root : a .Right : f c s .The result : h d b e a f c g .


Chapter 9 tree graphs

(2) Pre order traversal :-

Root : a .

Left : b d h e .

Right : c f g .

The result : h d e b f g c a .


Chapter 9 tree graphs

(3) Post order traversal:-

Left : h d e b .

Right : f g c .

Root : a .

The result : h d e b f g c a .


Chapter 9 tree graphs

  • Building Tree :

  • example:

  • Building trees with the data set …

    • (1) 50 , 60 , 40 , 30 , 20 , 45 , 65.

    • . (2) 10 , 20 , 30 , 40 , 50


Chapter 9 tree graphs

solution: (1)

Step1

Step2

Step3

Step4

50

50

50

50

40

60

60

60

40

30


Chapter 9 tree graphs

step 5

step 6

step 7

50

50

50

40

60

40

60

40

60

30

30

45

65

30

45

20

20

20


Chapter 9 tree graphs

solution: (2)

Step 1

Step 2

Step 3

Step 4

10

10

10

10

20

20

20

30

30

40


Chapter 9 tree graphs

Step 5

10

20

30

40

50


Chapter 9 tree graphs

عمل الطالبات :

  • سارة مبارك

  • مها مبارك

  • فاطمة مبارك

  • هيا فهد

  • غزاله ناصر

  • ريم عبد الله

  • نوره محمد

  • وفاء حمد


  • Login