problem with a tree that for you should be easy

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
IBelieve
New poster
Posts: 14
Joined: Sun Nov 16, 2003 7:40 pm

problem with a tree that for you should be easy

Post by IBelieve »

Hi ..
This is killing me:
You are given a tree with N vertexes. Write a program, that adds (if possible) a minimum number of edges so that each vertex becomes a part of not more than ONE cycle.
Sample input:
n=7
1 2
1 3
3 5
3 4
5 6
5 7
sample output:
6 7
4 2

can you give me at least some basic hints. i need to do this one till monday otherwise i'm dead.


[/i]
When people agree with me I always feel that I must be wrong.
Cosmin.ro
Learning poster
Posts: 95
Joined: Thu Aug 21, 2003 12:02 am

Post by Cosmin.ro »

You have to work with the biconnected components algo. But if you are from Cluj you should have acces to Ginfo where this is solved. Send me a private message if you really need to solve this.
IBelieve
New poster
Posts: 14
Joined: Sun Nov 16, 2003 7:40 pm

Post by IBelieve »

Cosmin.ro wrote:You have to work with the biconnected components algo. But if you are from Cluj you should have acces to Ginfo where this is solved. Send me a private message if you really need to solve this.
lots of thanks
When people agree with me I always feel that I must be wrong.
Post Reply

Return to “Algorithms”