wu :: forums
« wu :: forums - Centers of the tree »

Welcome, Guest. Please Login or Register.
Jun 1st, 2024, 1:56am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: towr, Icarus, Eigenray, ThudnBlunder, william wu, SMQ, Grimbal)
   Centers of the tree
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Centers of the tree  (Read 449 times)
alexeigor
Newbie
*





   


Posts: 45
Centers of the tree  
« on: Mar 20th, 2008, 1:20pm »
Quote Quote Modify Modify

Given tree. Vertex v is center of the tree if the distance from v to u (arbitrary vertex of the tree) is mininimal. Weights of edges is equal.
Find all centers of the tree.
For ex:
1 2
2 3
 
Answer:
2
« Last Edit: Mar 20th, 2008, 1:37pm by alexeigor » IP Logged
Aryabhatta
Uberpuzzler
*****






   


Gender: male
Posts: 1321
Re: Centers of the tree  
« Reply #1 on: Mar 20th, 2008, 4:21pm »
Quote Quote Modify Modify

I seem to recollect the following:
 
Remove zero (typo!) degree one nodes, and repeat. In the end you are either left with 1 or 2 nodes which form the center.
 
Probably not very efficient... (depends on the representation though)
« Last Edit: Mar 21st, 2008, 10:23am by Aryabhatta » IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board