Question
answer all and asap please
Solve the following recurrence relation in terms of m f(n) 5f(n-1) - 6f(n-2); n> 1 f(1) 1 5) f0)0
6) Explain how the two cycle are found in the graph illustrated below, using Depth First Search (DFS (int v, the graph as a l
Solve the following recurrence relation in terms of m f(n) 5f(n-1) - 6f(n-2); n> 1 f(1) 1 5) f0)0
6) Explain how the two cycle are found in the graph illustrated below, using Depth First Search (DFS (int v, the graph as a linked-list. int p) using the where p is the parent node of the vertex v. Represent
0 0
Add a comment Improve this question Transcribed image text
Answer #1

5. This recurrence relation is homogeneous recurrence relation. So let us write it in homogeneous form as

By putting an = f(n)

Then the recurrence relation is

an - 5an-1 + 6an-2 = 0

The characteristic equation of this recurrence relation is

t2 - 5t + 6 = 0

The equation will be (t-2)(t-3) = 0

The solution will be t = 2, 3

Hence the solution will be an = c12n + c23n

Now for n = 0, a0 = c1 + c2 = 0

and for n=1, a1 = 2c1 + 3c2 = 1

The solution will be

c1 = -1, c2 = 1

Hence f(n) = aa = 3n - 2n

6. Now that any vertex u in graph G=(V,E) can be the source of two cycle like vertex 3 in above figure. For a vertex u to be the source of two cycles, the degree of vertex must be at least 4.

Now let us discuss how we can detect whether a vertex u is source of two cycles or not using DFS.

First of all, note that if we perform DFS from vertex u and in DFS tree, if the degree of node u in DFS tree is less than the degree of node u in original graph G, then vertex u must be the part of some cycle in G because of which not all the edges incident on node u could become the part of DFS tree.  

Hence we perform DFS on vertex u, and check if degree of u in DFS is less than degree of u in original graph. If this does not happen then vertex u cannot be part of any cycle and we test on some other vertex. If this condition is satisfied then we check what is the difference between the degree of vertex u in original graph G and in DFS tree T, if the difference is more than 1 then this means vertex u is part of more than one cycle and select vertex u as the source vertex of 2 cycle and if the difference is 1 then u is only part of one cycle and hence try on some other vertex.

Since time complexity of DFS is O(V+E) and we perform DFS on each vertices, so the time complexity will be O(V(V+E)).

Please comment for any clarification.

Add a comment
Know the answer?
Add Answer to:
answer all and asap please Solve the following recurrence relation in terms of m f(n) 5f(n-1) - 6f(n-2); n> 1 f(1) 1 5) f0)0 6) Explain how the two cycle are found in the graph illustrated bel...
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
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
Active Questions
ADVERTISEMENT