, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

Similar documents
1 Introduction to Modulo 7 Arithmetic

Present state Next state Q + M N

QUESTIONS BEGIN HERE!

QUESTIONS BEGIN HERE!

Outline. Binary Tree

Constructive Geometric Constraint Solving

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Seven-Segment Display Driver

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

COMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

CS 461, Lecture 17. Today s Outline. Example Run

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Garnir Polynomial and their Properties

Designing A Concrete Arch Bridge

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

1. Determine whether or not the following binary relations are equivalence relations. Be sure to justify your answers.

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

Solutions to Homework 5

0.1. Exercise 1: the distances between four points in a graph

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

CS September 2018

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

CS200: Graphs. Graphs. Directed Graphs. Graphs/Networks Around Us. What can this represent? Sometimes we want to represent directionality:

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

EE1000 Project 4 Digital Volt Meter

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

CS 241 Analysis of Algorithms

12. Traffic engineering

Planar Upward Drawings

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

Multipoint Alternate Marking method for passive and hybrid performance monitoring

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

SAMPLE PAGES. Primary. Primary Maths Basics Series THE SUBTRACTION BOOK. A progression of subtraction skills. written by Jillian Cockings

Problem solving by search

OpenMx Matrices and Operators

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

The Plan. Honey, I Shrunk the Data. Why Compress. Data Compression Concepts. Braille Example. Braille. x y xˆ

Grade 7/8 Math Circles March 4/5, Graph Theory I- Solutions

CMSC 451: Lecture 2 Graph Basics Thursday, Aug 31, 2017

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

Walk Like a Mathematician Learning Task:

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f

Tangram Fractions Overview: Students will analyze standard and nonstandard

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.

Section 10.4 Connectivity (up to paths and isomorphism, not including)

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

Announcements. Not graphs. These are Graphs. Applications of Graphs. Graph Definitions. Graphs & Graph Algorithms. A6 released today: Risk

Decimals DECIMALS.

DFA Minimization. DFA minimization: the idea. Not in Sipser. Background: Questions: Assignments: Previously: Today: Then:

Numbering Boundary Nodes

Chem 104A, Fall 2016, Midterm 1 Key

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

COMP108 Algorithmic Foundations

Trees as operads. Lecture A formalism of trees

FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

The University of Sydney MATH 2009

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

Using the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas

Graph Contraction and Connectivity

Steinberg s Conjecture is false

MULTIPLE-LEVEL LOGIC OPTIMIZATION II

ECE 407 Computer Aided Design for Electronic Systems. Circuit Modeling and Basic Graph Concepts/Algorithms. Instructor: Maria K. Michael.

CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

Last time: introduced our first computational model the DFA.

Instructions for Section 1

Organization. Dominators. Control-flow graphs 8/30/2010. Dominators, control-dependence. Dominator relation of CFGs

arxiv: v1 [cs.ds] 20 Feb 2008

Properties of Hexagonal Tile local and XYZ-local Series

Greedy Algorithms, Activity Selection, Minimum Spanning Trees Scribes: Logan Short (2015), Virginia Date: May 18, 2016

NP-Completeness. CS3230 (Algorithm) Traveling Salesperson Problem. What s the Big Deal? Given a Problem. What s the Big Deal? What s the Big Deal?

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

arxiv: v1 [math.mg] 5 Oct 2015

Multi-Section Coupled Line Couplers

CSI35 Chapter 11 Review

Graph Theory. Vertices. Vertices are also known as nodes, points and (in social networks) as actors, agents or players.

Improving Union. Implementation. Union-by-size Code. Union-by-Size Find Analysis. Path Compression! Improving Find find(e)

Minimum Spanning Trees

Transcription:

nrl tr T is init st o on or mor nos suh tht thr is on sint no r, ll th root o T, n th rminin nos r prtition into n isjoint susts T, T,, T n, h o whih is tr, n whos roots r, r,, r n, rsptivly, r hilrn o r. r r r r omputr Sin pt V Th nury - MQuin W Rprsntin Th rprsnttion o nrl tr poss som hr hois: - My th numr o hilrn pr no vry ovr lr rn (possily with no loil uppr limit)? - Sttin n uppr limit rnrs som trs unrprsntl. - vn with n uppr limit, llotin ix numr o pointrs within h no my wst hu mount o sp. - Supportin vril numr o pointrs lso riss prormn issus. - ow n th pointrs orniz or sy trvrsl? os this rquir sonry t strutur within th no? - os th shm provi or iint srh? no insrtion? no ltion? r omputr Sin pt V Th nury - MQuin W

Link Nos mplmnttion Th inry no typ prsnt rlir n xtn or nrl tr rprsnttion. Th pointrs n mn y: - llotin uniorm-siz rry o no pointrs n limitin th numr o hilrn no is llow to hv; - llotin ynmilly-siz rry o no pointrs, ustom-it to th numr o hilrn th no urrntly hs (n r-sizin mnully s n); - usin link list o no pointrs; - usin vtor o no pointrs, rowin s n. h pproh hs pros n ons. r omputr Sin pt V Th nury - MQuin W List o hilrn Rprsnttion or h tr no, stor its t lmnt, (loil) pointr to its prnt no, n list o (loil) pointrs to its hilrn, usin rry s th unrlyin physil strutur: t Pr hl oul us ynmi list o nos inst omputr Sin pt V Th nury - MQuin W

Lt-hilrn/Riht-Silin Rprsnttion or h tr no, stor its t lmnt, (loil) pointr to its prnt no, n (loil) pointrs to its lt hil n its riht silin, usin rry s th unrlyin physil strutur: t Pr Lt hil Riht Silin omputr Sin pt V Th nury - MQuin W Prnt Pointr Rprsnttion or h tr no, stor its t lmnt n (loil) pointr to its prnt no, usin rry s th unrlyin physil strutur: omputr Sin pt V Th nury - MQuin W

quivln Rltions 7 Lt S st. n quivln rltion on S is olltion o orr pirs o lmnts o S suh tht: - or vry x in S, (x, x) is in rlxivity - or vry x n y in S, i (x, y) is in thn (y, x) is lso in symmtry - or vry x, y n z in S, i (x, y) n (y, z) r in thn (x, z) is lso in trnsitivity (x, y) is in thn w sy x is quivlnt to y. x is in S, th st o ll lmnts z o S suh tht (x, y) is in is ll th quivln lss o x, not [x]. omputr Sin pt V Th nury - MQuin W xmpl 8 Lt S th st o intrs throuh. in n quivln rltion on S: x is quivlnt to y i n only i x % n y % r qul. Thn: [] = {,,,,,, 8} [] = {,, 7,,,, } [] = {,, 8,,, 7, } Not tht vry lmnt o S is in xtly on o ths quivln lsss, n tht no two irnt quivln lsss hv ny lmnts in ommon. omputr Sin pt V Th nury - MQuin W

Thorms on quivln lsss Thm: Lt n quivln rltion on st S. Thn i x n y r lmnts o S, ithr [x] = [y] or [x] [y] =. Thm: Lt n quivln rltion on st S. Thn S quls th union o th istint quivln lsss unr. Th lttr thorm is usully sri s syin tht n quivln rltion prtitions st S into isjoint susts, rthr lik uttin pi o ppr into jisw puzzl. So wht os this hv to o with trs? W n rprsnt h quivln lss s nrl tr, n prtitionin s olltion (orst) o suh trs. omputr Sin pt V Th nury - MQuin W xmpl Rllin th rlir xmpl: [] = {,,,,,, 8} [] = {,, 7,,,, } [] = {,, 8,,, 7, } Th quivln lss [] my rprsnt y (ny) nrl tr ontinin th list vlus. or xmpl: 8 8 ivn this rprsnttion, how o w trmin i two vlus r quivlnt? omputr Sin pt V Th nury - MQuin W

trminin quivln Two vlus r quivlnt i thy r in th sm tr. Two vlus r quivlnt i th root nos o thir trs r th sm. W n in th root no y ollowin prnt pointrs upwr s r s possil. or this prolm, no othr typ o trvrsl is nssry, so th prnt "pointr" rprsnttion sri rlir is suiint. 8 omputr Sin pt V Th nury - MQuin W Pth omprssion owvr, quivln trs r not ll qully iint or trminin quivln. Th tr on th riht (low) is prrr us th pth rom h no to th root is o minimum lnth. ivn n quivln tr, suh s th on on th lt, w my improv its prormn y "omprssin" it vrtilly. Whnvr w strt t vlu, sy x, n srh or its root, w my thn tth th no ontinin x irtly to th root. This is known s pth omprssion. 8 8 omputr Sin pt V Th nury - MQuin W

uilin n quivln orst ivn st S n t spiyin whih lmnts r quivlnt (unr som quivln rltion ) w my uil olltion o trs tht rprsnt th quivln lsss o. nitilly, h lmnt is its own lss (ll nos r isolt). Two lmnts, x n y, r quivlnt i n only i th roots o thir rsptiv trs r th sm. isovrin tht two lmnts, x n y, r quivlnt implis tht thir quivln lsss must mr (thir rsptiv trs must join in som mnnr). Two nrl trs my join y mkin th root o on hil o th root o th othr. omputr Sin pt V Th nury - MQuin W xmpl Lt S = {,,,,,,,,, }. nitilly: 7 8 ivn ~: 7 8 ivn ~, 7 8 ~, ~, ~: omputr Sin pt V Th nury - MQuin W

xmpl Th lst stt orrspons to th orst: Now, ivn tht ~ w n to mr th irst two trs: irst in th root o h tr, n thn mk on root th prnt o th othr. t this point, th hoi o whih is to th prnt is ritrry. omputr Sin pt V Th nury - MQuin W xmpl Now w hv th ollowin orst. Suppos w r ivn tht ~ in, w n to mr two trs: r, w pply th Wiht Union Rul: tth th smllr tr to th root o th lrr tr. This rus th vr no pth. omputr Sin pt V Th nury - MQuin W

xmpl 7 Th n rsult is th ollowin orst: whih orrspons to th ollowin prnt pointr rprsnttion: 7 8 omputr Sin pt V Th nury - MQuin W