CSI35 Chapter 11 Review

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

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

QUESTIONS BEGIN HERE!

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

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

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

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

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

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

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

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

13. Binary tree, height 4, eight terminal vertices 14. Full binary tree, seven vertices v 7 v13. v 19

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

COMP108 Algorithmic Foundations

QUESTIONS BEGIN HERE!

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

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

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

10. EXTENDING TRACTABILITY

Minimum Spanning Trees

Section 3: Antiderivatives of Formulas

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

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

Examples and applications on SSSP and MST

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

Walk Like a Mathematician Learning Task:

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?

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

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

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

Chapter Finding Small Vertex Covers. Extending the Limits of Tractability. Coping With NP-Completeness. Vertex Cover

CS 241 Analysis of Algorithms

64. A Conic Section from Five Elements.

Weighted graphs -- reminder. Data Structures LECTURE 15. Shortest paths algorithms. Example: weighted graph. Two basic properties of shortest paths

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

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

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

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

Case Study VI Answers PHA 5127 Fall 2006

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

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

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

Preview. Graph. Graph. Graph. Graph Representation. Graph Representation 12/3/2018. Graph Graph Representation Graph Search Algorithms

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

Instructions for Section 1

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

Analysis of Algorithms - Elementary graphs algorithms -

Analysis of Algorithms - Elementary graphs algorithms -

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

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

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

3) Use the average steady-state equation to determine the dose. Note that only 100 mg tablets of aminophylline are available here.

Chapter 18. Minimum Spanning Trees Minimum Spanning Trees. a d. a d. a d. f c

Planar Upward Drawings

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

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

Evans, Lipson, Wallace, Greenwood

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

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

Last time: introduced our first computational model the DFA.

A Linear-Space Top-down Algorithm for Tree Inclusion Problem

Ch 1.2: Solutions of Some Differential Equations

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

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

GREEDY TECHNIQUE. Greedy method vs. Dynamic programming method:

12. Traffic engineering

Strongly Connected Components

1 1 1 p q p q. 2ln x x. in simplest form. in simplest form in terms of x and h.

Binomials and Pascal s Triangle

Problem solving by search

Floating Point Number System -(1.3)

Floating Point Number System -(1.3)

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

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

Solutions to Homework 5

UNCORRECTED SAMPLE PAGES 4-1. Naming fractions KEY IDEAS. 1 Each shape represents ONE whole. a i ii. b i ii

Searching Linked Lists. Perfect Skip List. Building a Skip List. Skip List Analysis (1) Assume the list is sorted, but is stored in a linked list.

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

Compression. Compression. Compression. This part of the course... Ifi, UiO Norsk Regnesentral Vårsemester 2005 Wolfgang Leister

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

Seven-Segment Display Driver

1 Introduction to Modulo 7 Arithmetic

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

Graph Theory Homework Summer 2018

XML and Databases. Outline. Recall: Top-Down Evaluation of Simple Paths. Recall: Top-Down Evaluation of Simple Paths. Sebastian Maneth NICTA and UNSW

Differentiation of Exponential Functions

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

Case Study Vancomycin Answers Provided by Jeffrey Stark, Graduate Student

Parallel Computation for Managing Transitive Relations. Yijie Han and Yugyung Lee. University of Missouri at Kansas City.

Polygons POLYGONS.

Constructive Geometric Constraint Solving

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

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

What do you know? Listen and find. Listen and circle. Listen and chant. Listen and say. Lesson 1. sheep. horse

Probability and Stochastic Processes: A Friendly Introduction for Electrical and Computer Engineers Roy D. Yates and David J.

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

Weighted Matching and Linear Programming

Computational Biology, Phylogenetic Trees. Consensus methods

Multi-Section Coupled Line Couplers

Transcription:

1. Which of th grphs r trs? c f c g f c x y f z p q r 1

1. Which of th grphs r trs? c f c g f c x y f z p q r

. Answr th qustions out th following tr 1) Which vrtx is th root of c th tr? ) wht is th hight of th f g h i j k m tr? 3) Which vrtics r n o p q r s chilrn of h? t u v 4) Which vrtics r silings w x y of n? z 5) Wht vrtics r intrnl? 6) Which vrtics r lvs? 7) Which vrtx is prnt of u? 8) Which vrtics r ncstors of t? 9) Which vrtics r scnnts of f? 10) wht vrtics r t lvl 3? 3 11) Is th tr lnc?

. Answr th qustions out th following tr 1) Which vrtx is th root of c th tr? ) wht is th hight of th f g h i j k m tr? 4 3) Which vrtics r n o p q r s chilrn of h? non t u v 4) Which vrtics r silings w x y of n? 0 n p z 5) Wht vrtics r intrnl?,, c,,, f, I, j, m, n, q. 6) Which vrtics r lvs? g, h, k, o, p, r, s, t, u, v, w, x, y, z,, 7) Which vrtx is prnt of u? m 8) Which vrtics r ncstors of t? m,, 9) Which vrtics r scnnts of f? n, o, p, w, x 4 10) wht vrtics r t lvl 3? n, o, p, q, r, s, t, u, v 11) Is th tr lnc? No, cus w hv lvs t lvls,3,n 4

3. Dtrmin which trs r full, complt, or nithr. f c g c T 1 T h f g T 3 5 T 4 T 5

3. Dtrmin which trs r full, complt, or nithr. c f g c nithr T h nithr 1 T f g T 3 full T 4 complt T 5 complt 6

4. ) How mny nonisomorphic root trs r thr with fiv vrtics? ) How mny nonisomorphic unroot trs r thr with fiv vrtics? 7

4. ) How mny nonisomorphic unroot trs r thr with fiv vrtics? vrtics of gr 1, n 3 vrtics of gr 3 vrtics of gr 1, 1 vrtx of gr, n 1 vrtx of gr 3 4 vrtics of gr 1, n 1 vrtx of gr 4 Answr: 3 trs 8

Answr: 9 trs CSI35 Chptr 11 Rviw 4. ) How mny nonisomorphic unroot trs r thr with fiv vrtics? vrtics of gr 1, n 3 vrtics of gr 3 vrtics of gr 1, 1 vrtx of gr, n 1 vrtx of gr 3 4 vrtics of gr 1, n 1 vrtx of gr 4 ) How mny nonisomorphic root trs r thr with fiv vrtics? 9

5. ) How mny gs os tr with 80 vrtics hv? ) How mny intrnl vrtics os full inry 3-ry tr with 113 lvs hv? c) How mny vrtics os complt 4-ry tr of hight 6 hv? 10

5. ) How mny gs os tr with 80 vrtics hv? A tr with n vrtics hs n-1 gs, hnc th givn tr hs 79 gs. Answr: 79 gs ) How mny intrnl vrtics os full inry 3-ry tr with 113 lvs hv? m = 3, l = 113, hnc i= l 1 m 1 =113 1 3 1 =11 =56 Answr: 56 intrnl vrtics c) How mny vrtics os complt 4-ry tr of hight 6 hv? lvl 0: 1 vrtx 4 0 lvl 1: 4 vrtics 1*4 = 4 1... lvl : 4 vrtics 1*4 1 = 4 4 6 Answr: 1 + 4 + 4 + 4 3 + 4 4 + 4 5 + 4 6 vrtics. 11

6. Givn inry tr (s low), insrt th following numrs, on y on: 10, 14, 66, 79, n 37. 45 6 76 65 89 53 70 1

6. Givn inry tr (s low), insrt th following numrs, on y on: 10, 14, 66, 79, n 37. 45 10 6 37 76 65 89 14 53 70 79 66 13

7. How mny wighings of lnc scl r n to fin countrfit coin mong four coins if th countrfit coin cn ithr hvir or lightr thn th othrs? 14

7. How mny wighings of lnc scl r n to fin countrfit coin mong four coins if th countrfit coin cn ithr hvir or lightr thn th othrs? Dscri n lgorithm. Answr: 3 wighings. Th lgorithm: x 1,x : x 3,x 4 x 1,x lightr x 3,x 4 lightr x 1 : x x 3 : x 4 x 1 lightr sm x lightr x 3 l x 4 lightr sm x 1 x 1 : x 3 x x 3 x 1 : x 3 x 4 sm not lnc sm not lnc 15 x 4 x 3 x x 1

8. Construct th inry tr with prfix cos rprsnting ths coing schms: : 1 : 01 c: 001 : 0001 : 00001 16

8. Construct th inry tr with prfix cos rprsnting ths coing schms: : 1 : 01 c: 001 : 0001 : 00001 0 0 1 0 1 0 c 1 1 1 A vrition of qustion: trmin which of th givn cos 17 r prfix cos.

9. Us Huffmn coing to nco th symols with th givn frquncis. : 0.4 : 0. c: 0.1 : 0.15 : 0.13 f: 0.0 18

9. Us Huffmn coing to nco th symols with th givn frquncis. : 0.4 : 0. c: 0.1 : 0.15 : 0.13 f: 0.0 0.0 f 0.1 c 0.13 0.15 0. 0.4 Initil stp 0.1 0 1 c f 0.15 0. 0.13 0.15 0.5 0 1 0 1 c f 0. 0.4 0.4 1 st itrtion n itrtion 19

9. Us Huffmn coing to nco th symols with th givn frquncis. : 0.4 : 0. c: 0.1 : 0.15 : 0.13 f: 0.0 0.5 0.35 0.4 0 1 0 1 0 1 c f 0.6 1 0.4 0 0 1 0 1 0 1 c f 4 th itrtion 3 r itrtion 0

9. Us Huffmn coing to nco th symols with th givn frquncis. : 0.4 : 0. c: 0.1 : 0.15 : 0.13 f: 0.0 0 1 0 0 1 c 5 th itrtion 1 0 1 1 0 1 f prfix co: : 1 : 000 c: 0110 : 001 : 010 f: 0111 Th vrg numr of its rquir to nco symol is: 0.4*1 + 0.*3 + 0.1*4 + 0.15*3 + 1 0.13*3 + 0.0*4 =.3

10. List th vrtics of th tr visit uring ) prorr trvrsl ) inorr trvrsl c) postorr trvrsl of th tr. c f g h i j k m n

10. List th vrtics of th tr visit uring ) prorr trvrsl ) inorr trvrsl c) postorr trvrsl of th tr. c f g h i j prorr trvrsl:,,, k, m, f, c, g, h,, i, n, j inorr trvrsl: k,, m,, f,, g, c, h, n, i,, j postorr trvrsl: k, m,, f,, g, h, c, n, i, j,, k m n 3

10. Rprsnt (A B) (A (B A)) using n orr root tr. Thn writ th xprssion in prfix, postfix n infix nottions. 4

10. Rprsnt (A B) (A (B A)) using n orr root tr. Thn writ th xprssion in prfix, postfix n infix nottions. A B A prfix : A B A B A postfix: A B A B A infix: (A B) (A (B A)) B A 5

11. Evlut th prfix xprssion + - ^ 3 ^ 3 / 6 4. 6

11. Evlut th prfix xprssion + - ^ 3 ^ 3 / 6 4. + - ^ 3 ^ 3 / 6 4 4-= + - ^ 3 ^ 3 / 6 6/ = 3 + - ^ 3 ^ 3 3 3 = 8 + - ^ 3 8 3 3 = 9 + - 9 8 3 9 8 = 1 + 1 3 1 + 3 = 4 + - ^ 3 ^ 3 / 6 4 = 4 7

1. Us pth-first-srch (DFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n f i j k m p o 8

1. Us pth-first-srch (DFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n f i j k m p o 9

1. Us pth-first-srch (DFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n f i j k m p o 30

13. Us rth-first-srch (BFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n f i j k m p o 31

13. Us rth-first-srch (BFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n i j k f L = {,, c,,, f, i, g, h, j, k, q, m, n, o, p} m p o 3

13. Us rth-first-srch (BFS) lgorithm to prouc spnning tr for th givn simpl grph. Us vrtx s th root of th spnning tr. c g h q n i j k f L = {,, c,,, f, i, g, h, j, k, q, m, n, o, p} m p o 33

14. Us Prim's or Kruskl's lgorithms to fin minimum spnning tr for th givn wight grph. 1 c 1 1 i 3 n 3 3 f 3 g 3 4 3 j 4 k 3 4 3 o p 3 m 1 h 3 q 34

14. Us Prim's or Kruskl's lgorithms to fin minimum spnning tr for th givn wight grph. 1 c 1 1 i 3 n 3 3 f 3 g 3 4 3 j 4 k 3 4 3 o p 3 m 1 h 3 q 35

14. Us Prim's or Kruskl's lgorithms to fin minimum spnning tr for th givn wight grph. 1 c 1 1 1 g f h i 3 j k 3 m n o p q 36