0% found this document useful (0 votes)
24 views

Trees & Graphs

Data structures trees and graphs all concepts covered with examples

Uploaded by

Moorty Bhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
24 views

Trees & Graphs

Data structures trees and graphs all concepts covered with examples

Uploaded by

Moorty Bhat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
NS = Trees 4 Non-linear data shucbure ae Stee dake In ial “mann” pb esny Roob now fe leaf noaw | Rook, children, Parent , Gand pavort, Grand. tldven, sfbling, leaf, Tnlemedinte nodes, | +14 Wo Gotmm @ to ® thn, @® te tho andstor of © ® fs the eendort op @ ye Tey fe Reowsive Dake rude 4 Ty trey has fn nodag Athan [nt edges |. % Depth of x = (ugh of path trom toob-to x. @) No of edges am path -from oot: +04 # Hg oy x = No of edgs tn Longest path tent pow Joa, + Aaght of drew= Height of oot node. Scanned with CamScanner J), ginary Theos Trees fe tree fy Which each:-node can have atinsk a tldven, > Ful | Shi Binary Trees Either v (oy) a children. ‘h AN => Almast Complete Binary Tree_ ne We have -to fell tho tren Node* (ee; | node Tohb; Js d canned with CamScanner * Peplfations: A) ofytng Naturally hieraretal dake Ex: File system 48) Ovgantze, data fay Gulch Starch, Ansertion, deletton. Ext Binary seanth tres Xa) Tytu 2 Usd to dynante Set checking Cteltonag) <4) Nebwork Reuking Algorithm > Balonced Binary “Tree? os UO 1 ketaht le & Re he subpree or oy et is nob 10 7 hank (mostly 2). | + Hetght of an empty treet | ai ob -tren with 4 odo = 0 ! | Diferonce = “(hes “hngt) 1 } Wwe a We can Cinnplannerct Bthosy ree usta tay Dynuntealy Grated Todos aby Fivrays. (Used for heaps) + Binoy) Surh Tet (esp: © . . hinked Beh RST weoch(%) olny. OH). Clagn) -apeub (2) ow ow) 0 (loyn) otn) ot) + + 9. Cogn) j Poros (OD Scanned with CamS@nner 4 & Binary ctree Yn which -for each node, Value of all the Teds ty eff subtres te lesser and value of all tho nods tn -y4ght- Subtre 9S greater. ey Tee “Praversal Techniques: Preorder > Rook bof Rrghb order —> lath Rook Righ’ Post-order — Lott Right Root Precyoar > Unvvder HD § ® Postoder 7 2% ~\ # Preorour: FRADCE GLY 4 Tower: ABCDEFGHT Nn 4 Poskordayr: Ge ) a “ACES HIG Scanned with CamScanner 1 Preovdee ao Tnorder 8— Postovder =: —z__—_—_—s—=™te = | ® Binary Search’ Tree, (857)! 4 8,3,6,5,7,4 ' J 2 => Grophs: AL Giaph “Get an ovelored. pair. of-ar sek “V" of veritas ond a set “EF edges. ' Ye (Nb VR, V8, V4, V5, V6, VT BP Ee CAviva), OVIVS}, CV VEY, Lave}, vas}, | * cagest : ent, {varvey, av, VB4, 4S, V84, Nb vd, oe a: ‘Gi aisha) (unuieded) (uw) . fuypo Canned with Camcanner ¥ + Undivected raph: . Xe Mlorid Wider Web (www): ~ ~ Scanned with cambanner * fps of Gein: + tap ~ § g + MulliedRe, on a Parallel edgo “No. oly Edges’ ) lem . a pd then | oélel ener) “ireeed) soe Mt aa patel OED Ve GvLva von aq Wl=F Gnaiver{ed) + Denee —> Too MOMY odes SpOree —> “Too fou! eave Lah: quae of weries Wha each oft pair t9 ~ connacledt by an edée- + simyle. path: Path tn which no yertes (thus edges) ot Walk? “A sequences of veyfpas where each odjacok Poly fe connected by an edo, » path: ft x walk m Which a0 - vers Chu ~~) OMe Tepeated, = Toll. A nalts fn Whi NO cps are vig strongly Connected Connected Graphs . y shore $s 0 path fom ony wer to any Other Node, Weal G nr © hoagly (Grnected) Connected) ‘cloged Woks Starts 4 ends a&-Gamo” Vortex, * tole ‘cyclen No repelton ofhur than hake 9 en * Aojelio gregh: fe graph with no cyclo ANvie aydlic gph) ~ Scanned with CamScanner | F Gagh Representations | Vudu ed et iat Tal (a |= SiArela\s E| qeasteece [4] €|+|@|>|=/eJo]e A =) E Fi <2 Shuck Edge + Vee tStavtNlartex ; char ¥ endverters = + ink weight; 33 4 (or), closs Edge . t Shing eka Wurlex; big vores [ma Shing) endvertes; ° Edge Bdgeliet (vedi int weight; . 4 : Scanned with CamScanner » Graph “Raversal; fay Breadth Fivst Search (BES) doy Depth Fivst Search (DFS) BRS des 1,2,3,4,1,5,6 4,8,4,5,6,3,7 (wo Laat, 65 Scanned with CamScanner

You might also like