Solutions of Theory of Algorithms assignment23.2-2

Solutions of Theory of Algorithms assignment23.2-2 - 7 do u...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Solutions of Theory of Algorithms assignment 2 Exercise 23.2-2 MST-PRIM( G , w , r ) 1 for each u V [ G ] 2 do key [ u ] ← ∞ 3 π[ u ] ← NIL 4 key [ r ] ← 0 5 for i=1 to n 6 for j=1 to n "traversing the whole matrix"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 7 do u search for the smallest element in the matrix 8 for each v Adj [ u ] 9 do if w ( u , v ) < key [ v ] 10 then [ v ] u 11 key [ v ] w ( u , v )...
View Full Document

This note was uploaded on 11/07/2010 for the course CS 11841 taught by Professor Dr.ayman during the Spring '09 term at Alexandria University.

Ask a homework question - tutors are online