1 / 13

Chapter 9 “ Tree graphs ”

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.

satya
Télécharger la présentation

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 9 “Tree graphs”

  2. Tree it is graphs it have edeges and vertices but has no cycles

  3. Traversal Tree There are 3 standard ways of traversing a tree with root R. In order traversal Pre order traversal Post order traversal

  4. example: Apply traversal to print the tree: a b c d e f g h

  5. 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 .

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

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

  8. Building Tree : • example: • Building trees with the data set … • (1) 50 , 60 , 40 , 30 , 20 , 45 , 65. • . (2) 10 , 20 , 30 , 40 , 50

  9. solution: (1) Step1 Step2 Step3 Step4 50 50 50 50 40 60 60 60 40 30

  10. step 5 step 6 step 7 50 50 50 40 60 40 60 40 60 30 30 45 65 30 45 20 20 20

  11. solution: (2) Step 1 Step 2 Step 3 Step 4 10 10 10 10 20 20 20 30 30 40

  12. Step 5 10 20 30 40 50

  13. عمل الطالبات : • سارة مبارك • مها مبارك • فاطمة مبارك • هيا فهد • غزاله ناصر • ريم عبد الله • نوره محمد • وفاء حمد

More Related