Data Structures & Alogs HW_Part_19

Data Structures & Alogs HW_Part_19 - 73 2 3 1 10 x 2 3...

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

View Full Document Right Arrow Icon
73 23456 110x 20x 2 2 35x1 2 3x 1 5 x 41 1 1 0 53 2-paths: 1101315x 2 2 2 3 8 15 15 1 1 0 3-paths: 2 351 81 2 38 1 5 x 1 1 0 4-paths: 110131531 2 2 61 2 3 8 15 15 1 1 0 5-paths: 2 2 3 8 15 15 1 1 0 6-paths:
Background image of page 1

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

View Full DocumentRight Arrow Icon
74 Chap. 11 Graphs 23456 11013126 2 2 351 61 2 3 8 15 15 41 1 1 0 53 11.16 The problem is that each entry of the array is set independently, forcing pro- cessing of the adjacency list repeatedly from the beginning. This illustrates the dangers involved in thoughtlessly using an inef f cient access member to a data structure implementation. A better solution is to process the actual edges within the graph. In other words, for each vertex, visit its adjacency list. Set the shortest-paths array by setting the values associated with that edge. If the array is initialized with values of , then any vertices not connected by an edge will retain that value. 11.17 Clearly the algorithm requires at least Ω( n 2 ) time since this much informa- tion must be produced in the end. A stronger lower bound is dif f cult to obtain, and certainly beyond the ability of students at this level. The primary
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 10/31/2011 for the course BCN 3431 at University of Florida.

Page1 / 4

Data Structures & Alogs HW_Part_19 - 73 2 3 1 10 x 2 3...

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

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