1 / 13

# - PowerPoint PPT Presentation

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.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about '' - satya

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

9

“Tree graphs”

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

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

In order traversal

Pre order traversal

Post order traversal

Apply traversal to print the tree:

a

b

c

d

e

f

g

h

• (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 .

Root : a .

Left : b d h e .

Right : c f g .

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

Left : h d e b .

Right : f g c .

Root : a .

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

• Building Tree :

• example:

• Building trees with the data set …

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

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

Step1

Step2

Step3

Step4

50

50

50

50

40

60

60

60

40

30

step 6

step 7

50

50

50

40

60

40

60

40

60

30

30

45

65

30

45

20

20

20

Step 1

Step 2

Step 3

Step 4

10

10

10

10

20

20

20

30

30

40

10

20

30

40

50

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

• سارة مبارك

• مها مبارك

• فاطمة مبارك

• هيا فهد

• غزاله ناصر

• ريم عبد الله

• نوره محمد

• وفاء حمد