7_trees - Introduction to Computers and Programming Prof....

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 7 April 2 2004 Concept Question 1. Both G1 and G2 are Graphs 2. Only G1 is a Graph 3. Only G2 is a Graph 4. Neither G1 nor G2 are Graphs G1(V1,E1) where V1 = {}, E1 = {} G2(V2,E2) where V2 = {a,b}, E2 = {} A graph G(V, E) is a finite nonempty set of vertices and a set of edges G1(V1,E1) where V1 = {}, E1 = {} G2(V2,E2) where V2 = {a,b}, E2 = {}
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
[Theorem] Theorem : a mathematical statement that can be shown to be true – Can be proved using other theorems, axioms (statements which are given to be true) and rules of inference Lemma : a pre-theorem or result needed to prove a theorem Corollary : post-theorem or result which follows directly from a theorem • Proposition •C la im •Rema rk Why should we use trees? 4 2 15 9 5 7 5 4 2 9 7 15 Binary Search Tree
Background image of page 2
5 A tree is a connected undirected graph with no simple circuits. – it cannot contain multiple edges or loops Trees Theorem : An undirected graph is a tree if and only if there is a unique simple path between any two of its vertices. 6 Which graphs are trees? a) b) c) d)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Rooted Tree • A directed graph G is called a rooted tree if there exists a vertex u so that for each v V, there is exactly one path between u and v – The in-degree of u is 0 and the in-degree of all other vertices is 1 • For an undirected graph, different choices of the root produces different trees Choice of Root a g d f e c b a g b d e f c b c a dg f e Examples of Rooted Trees?
Background image of page 4
9 • A vertex that has children is called an
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

7_trees - Introduction to Computers and Programming Prof....

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online