ThisThe document covers trees and graphs in data structures, Cheat Sheet of Data Structures and Algorithms

The document covers trees and graphs in data structures: 1. **Trees**: Represent hierarchical data with a root node and up to two children per node (binary tree). Key concepts include paths, descendants, and leaf nodes. 2. **Binary Tree Traversals**: 3. **Binary Search Tree (BST)**: Left subtree < root, right subtree > root, no duplicates. Inorder traversal yields sorted sequence. Example: Build BST from B3, B1, B4, B2, B5, B6. 4. **Operations**: Includes searching (e.g., key = 3), insertion, and deletion (replacing with inorder successor for nodes with two children). 5. **Prefix Expression Evaluation**: Evaluates expressions like -++abe*/aef with given values (e.g., a=2, b=2, e=2, f=3). 6. **Other Data Structures**: Mentions bubble sort, insertion sort, merge sort, selection sort, stacks, queues, circular queues, and tree traversals.

Typology: Cheat Sheet

2022/2023

Available from 06/29/2025

muhtasim-ahmed
muhtasim-ahmed 🇧🇩

2 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download ThisThe document covers trees and graphs in data structures and more Cheat Sheet Data Structures and Algorithms in PDF only on Docsity!

Real ile excample_ 7 opie explandio ree “Trea & we og WAdharlaae seal verre ——e cree , code. “ato 1 O Non-= Unoare | Grueturte ushiely th mainly y _ wed rpreert data Cointasnaing On Weaar Uvieal rolaHorslvp ° reledionship “vehunear' lore Root Posunt ald | Gupte Ancospore Path fom to that node .aee2 _Patenden any S4eteosor nade Ore any From yoda “th a loch pode - Binary tree. tetop rns temart elled coor ® Cool rode hag ot On of the most DQ children ( mare mum 2. branches ) Se Surat draw TAO WT, a we true &. greph “dent RE -Io-! a%,-\, b, ~b- \ a free enaees (, 24a, -U po i Contnuchion | Of ain Treeg ¢ at lati inp Pestondere, ‘ tr 2, i, ay 5! », iy Ie ? j ; , ‘ Ve) Red nt aden, ¢ bib 2, 2 108 4 bh, iv om) ps , t Binaty bea neh Hee q > eft Subtue rot +? rei ght subtree > rot > heft and au ‘ subtrees ame alfo BST with “mo doplieabes - (4) @ © / de OY @ ©. Forder traverdal of B57 “Gives a | sorted $ eee Ch _* pyle Gn tadenc “ ni ae By: 4 §,S. ys | Based on Dineclion ; ata Bly | Tae to ayele Gunnginal Joi draco ae Quni- Lrudional 3 O® Rased AL cei a ee ; Be hi gy Oun- ae rt pe e Ae 2,0 * Goh u cr amare us \ Adpesen 4 matin 4 9 ug YPISTI dei gl om replace “Oo” | 1 Edge bist : Leste feof, me Ly | bse foe, if + (ashwei(uyt so ‘tavl sly v) £ distance Ww) 1 “Uiglen ee i} odayanee(u) + cost (u, J Minimum. Spannary iN) Fred? “| 6 Ping Algorithm fe Ds Bxpreedoions ( . min — HBF parain d= operand — Posthiat —VArBe a operator.” Age & 1 Ke, “ee o perder. — opera, Preeiog ~ opertand A + (bx @) Po A+ eB post ue oe) +Aw OE | i atin 7 Infix'+o postior As o-e¥pe(eae)e fy [I 3 | Expression} Stack P Postion bi ge PTT The + + a % + AG | = a Ath+ Cc _ ABT @ — Arte —¥ An+ ep + AGL ED #— oh Ge AGBt Cpe — Preafie expratiion evalyadi ons 2, be%, doy, dele oo, fen . as ‘Y » | meh V2 a 4 at be e-d /e Mt | (opt) — (spertibr)-(op tains ~-+arbe/Jree 6 A —+2,.¥% ® WEAR oe | | 259 | 28 \ {yl { t ry - =-4gr5M/le 2 1/2 eS ae ee ee I; po | ee ae PASH A Ve | = a, ; | / | | PTW adn yy eean er [ using stack — PrefinceaPray befme gm |» | Peaking | (ERR A GY Ab ROR Pw | ; aS SN LOR ANWAR crs Y “4. | SOE LO Be gna eh : j [IGh Ss : Qe, VI OM GIRIG A c. Op 2=8 6/8 = Qe ? 2 ee a opus te 4 Bes. Lu Opa re 6p J = Uy fy apa 2% ry? 1 pos fr operaltone rovaluation aon dtaek | AzL) peop ted? be, < ca, te O° abe fade h ajo aa my BA Ge an fa } ba by ee eitthusle 2 3,0 /- A, SIAC Yoke rare -s m4 wu 8. ey Qe. |4 Qe = ee 24% aa \L— ‘ rhe yraga sa) 3 Using Hiehes OT al lid 2° of 1724 pL — openabrt + tepals 3 > Lhe Vee, , OP 2 sie, : ? OP De :@\