Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Minimum Spanning Trees: Understanding the Concept and Algorithm - Prof. Gary Locklair, Assignments of Computer Science

An overview of minimum spanning trees, their importance in graph theory, and the algorithm used to find them. Practical examples of data structures like arrays, stacks, queues, heaps, lists, and trees, as well as discussions on polynomial and non-polynomial time complexities. It also includes a step-by-step explanation of the minspan algorithm and an example of its application.

Typology: Assignments

Pre 2010

Uploaded on 07/23/2009

koofers-user-tz1
koofers-user-tz1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
19 September, Day 7
Written Assignment #2 due
Wassn0, part A – resume due today
Sassn1 presentation given next time, Day 8
assign Wassn3
Chapter 22 – Minimum Spanning Trees
Data Structures:
Arrays
Stacks – LIFO access
practical example?
Queues – FIFO access
practical example?
Heap – dynamic structure with no specified internal organization
use pointers
List, eg Linked List
advantage: noncontiguous storage
physical order isn’t important
can easily reorder via pointers
Trees – a 1-to-n stucture
hierarchical – ex:
Graphs – a m-to-n structure
Dewdney’s terms: vertex/vertices (node)
edge
Read beginning of Chapter 22
Polynomial Time – means we have a “reasonable” algorithm for solving
the problem. In other words, as the problem input space gets “bigger”
we can still solve it in a reasonable amount of computational time.
Example: the GCD algorithm. Finding the GCD of 1740 and 90 does
not take that much more time than the GCD of 135 and 5. Yes, more
times through loop, but still P time. We’re guaranteed an answer in a
reasonable amount of time.
NP (nonpolynomial time) – as problem input space gets bigger, we’re
not guaranteed a reasonable amount of computational time. Example:
factorial. n! = n * (n-1)! 6! = 6*5*4*3*2*1 How to solve? A for loop.
But notice that time depends upon “size” of problem. Computing 100!
takes much, much longer than computing 5!
CSC 490 Course Notes and Outline, © Dr. Gary Locklair, Fall 2006
pf3

Partial preview of the text

Download Minimum Spanning Trees: Understanding the Concept and Algorithm - Prof. Gary Locklair and more Assignments Computer Science in PDF only on Docsity!

19 September , Day 7 Written Assignment #2 due Wassn0, part A – resume due today Sassn1 presentation given next time, Day 8 assign Wassn Chapter 22 – Minimum Spanning Trees Data Structures: Arrays Stacks – LIFO access practical example? Queues – FIFO access practical example? Heap – dynamic structure with no specified internal organization use pointers List, eg Linked List advantage: noncontiguous storage physical order isn’t important can easily reorder via pointers Trees – a 1-to-n stucture hierarchical – ex: Graphs – a m-to-n structure Dewdney’s terms: vertex/vertices (node) edge Read beginning of Chapter 22 Polynomial Time – means we have a “reasonable” algorithm for solving the problem. In other words, as the problem input space gets “bigger” we can still solve it in a reasonable amount of computational time. Example: the GCD algorithm. Finding the GCD of 1740 and 90 does not take that much more time than the GCD of 135 and 5. Yes, more times through loop, but still P time. We’re guaranteed an answer in a reasonable amount of time. NP (nonpolynomial time) – as problem input space gets bigger, we’re not guaranteed a reasonable amount of computational time. Example: factorial. n! = n * (n-1)! 6! = 65432*1 How to solve? A for loop. But notice that time depends upon “size” of problem. Computing 100! takes much, much longer than computing 5!

Figure 22.1 vertex = node; edges are labeled to make life easier, label each vertex(node) with a capital letter A, B, C, etc note that 22.1 isn’t minimum replace either leftmost 13 or 12 with 6 edge below it Greedy algorithm – optimize whole by optimizing each step MINSPAN algorithm (will “grow” the tree one edge at a time, always picking best available edge)

  1. u <- A (arbitrary vertex at upper left corner of graph)
  2. T (the minimum spanning tree to be created) <- {A}
  3. L (list of edges incident [connecting] to u) <- {AC of length 8, AB of length 7}
  4. sort L with smallest edge first (AB of length 7, AC of length 8}
  5. now do it! note: a change is some edge values from fig 22.1 to 22.2 (book error?) Follow the algorithm and discussion to see how minimum spanning tree was created. Show the order in which each heavy edge of spanning tree was added to the graph: