Question: Make sure to read carefully. You may write procedures in pseudocode or in any programming language the TA s know. Procedures can use helpers .
Make sure to read carefully. You may write procedures in pseudocode or in any programming language the TAs know. Procedures can use helpers Anadjacency structureis what Cormen mistakenly calls anadjacency liston page
points. Suppose thatGis a directed graph. It has an adjacency structureGAdj,a set of edgesGEand a set of vertexesGVEach vertexvGVhas an attributevmarkTRUEFALSE It has no other attributes! In particular, it has nocolor d forattributes like Cormens vertexes do
A vertexvGVis anorigin vertexinGif there is exactly one path fromvto every other vertex inGV The wordoriginis meant to suggest that every vertex inGis reachable starting fromvDont bother looking fororigin vertexonline: the only hits you will get are irrelevant to this question: they deal with parabolas from highschool algebra.
Write a procedure ISORIGINGu that returnsTRUEif the vertexuis an origin in the graphGand returnsFALSEotherwise Your procedure must always terminate, even ifGhas cycles or self edges. You will lose many points if it uses vertex attributes other thanmark
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
