Question

4.1 4.1 Insertion Sort 4. Design 137 the a algorit
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The answer is No

One example, where it would fail for some cases is, when call to Connected( A[0..n-2, 0...n-2 ] ) would return false, and we consider the graph represented by A[0..n-1, 0...n-1 ] to be not connected

This is because, that n-1 th vertex can very well connect the graph represented by A[0..n-2, 0...n-2 ] and thus graph can be connected, and our algorithm fails.

Let me give a simple example, say following is the adjacency matrix:

0 0 1
0 0 1
1 1 0

Now clearly A[0..1,0..1] is not connected, i.e. vertex 0 and 1 are not connected.

But vertex 2 connects them, by being the middle one, and thus whole graph is infact connected. The given algorithm will fail here.

Add a comment
Know the answer?
Add Answer to:
4.1 4.1 Insertion Sort 4. Design 137 the a algorithm for generating the power set of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Warshall's Algorithm To which other algorithm from our course is Wasrhall's Transitive Closure algorithm most...

    1. Warshall's Algorithm To which other algorithm from our course is Wasrhall's Transitive Closure algorithm most structurally similar? A) Dijkstra B) Floyd C) Kadane D) Karatsuba E) Kruskal F) Prim G) Strassen 2. Powers of Adjacency Matrix Which is true of an Adjacency Matrix of a directed graph raised to the k-th power (A^k) A) A^k ​[i]​[j] = 1 if there is an edge of length k from vertex i to vertex j B) A^k ​[i]​[j] = 1 if there...

  • Use Prim's algorithm (Algorithm 4.1) to find a minimum spanning tree for he following graph. Show...

    Please solve the problem in a clear word document not hand writing Use Prim's algorithm (Algorithm 4.1) to find a minimum spanning tree for he following graph. Show the actions step by step. 32 17 45 18 10 28 4 25 07 59 V10 4 12 4.1 MINIMUM SPANNING TREES 161 void prim (int n const number Wll set of.edges& F) index i, vnear; number min edge e; index nearest [2.. n]; number distance [2.. n]; for (i= 2; i...

  • Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void...

    Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void main(String[] args) { int currentVertex, userChoice; Scanner input = new Scanner(System.in); // create graph using your WeightedGraph based on author's Graph WeightedGraph myGraph = new WeightedGraph(4); // add labels myGraph.setLabel(0,"Spot zero"); myGraph.setLabel(1,"Spot one"); myGraph.setLabel(2,"Spot two"); myGraph.setLabel(3,"Spot three"); // Add each edge (this directed Graph has 5 edges, // so we add 5 edges) myGraph.addEdge(0,2,9); myGraph.addEdge(1,0,7); myGraph.addEdge(2,3,12); myGraph.addEdge(3,0,15); myGraph.addEdge(3,1,6); // let's pretend we are on...

  • Please write the complete code in C. Write a C function that prints the minimum spanning...

    Please write the complete code in C. Write a C function that prints the minimum spanning tree of a graph. At the end, print the weight of the spanning tree. A suggested report format is shown in the following example. Source Vertex To Vertex Weight A B 2 A C 4 B D 3 D E 1 Total weight of spanning tree: 10 Your main program will read a graph from DataIn file to an adjacency table before calling the...

  • Below is the Graph file that needs to be modified(using Python3) : #!/usr/bin/python3 # Simple Vertex...

    Below is the Graph file that needs to be modified(using Python3) : #!/usr/bin/python3 # Simple Vertex class class Vertex: """ Lightweight vertex structure for a graph. Vertices can have the following labels: UNEXPLORED VISITED Assuming the element of a vertex is string type """ __slots__ = '_element', '_label' def __init__(self, element, label="UNEXPLORED"): """ Constructor. """ self._element = element self._label = label def element(self): """ Return element associated with this vertex. """ return self._element def getLabel(self): """ Get label assigned to...

  • Your teacher is going to give a test where each student is to answer one question. None of the neighboring students should have the same question. How many questions are needed? Graph Coloring Algorit...

    Your teacher is going to give a test where each student is to answer one question. None of the neighboring students should have the same question. How many questions are needed? Graph Coloring Algorithm is used to solve this type of problems. It does not guarantee to use the minimum number of questions, but it guarantees an upper bound on the number of questions. The algorithm never uses more than d+1 questions where d is the maximum degree of vertices...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT