Abstract: We consider the problem of finding a k<math><mtext>k</mtext></math>-median in a directed tree. We present an algorithm that computes a k<math><mtext>k</mtext></math>-median in O(Pk2)<math><mtext>O</mtext><mtext>(Pk</mtext><msup><mi></mi><mn>2</mn></msup><mtext>)</mtext></math> time where k<math><mtext>k</mtext></math> is the number of resources to be placed and P<math><mtext>P</mtext></math> is the path length of the tree. In the case of a balanced tree, this implies O(k2nlogn)<math><mtext>O</mtext><mtext>(k</mtext><msup><mi></mi><mn>2</mn></msup><mtext>n</mtext><mtext>log</mtext><mtext>n)</mtext></math> time, in a random tree O(k2n3/2),<math><mtext>O</mtext><mtext>(k</mtext><msup><mi></mi><mn>2</mn></msup><mtext>n</mtext><msup><mi></mi><mn>3/2</mn></msup><mtext>),</mtext></math> while in the worst case O(k2n2)<math><mtext>O</mtext><mtext>(k</mtext><msup><mi></mi><mn>2</mn></msup><mtext>n</mtext><msup><mi></mi><mn>2</mn></msup><mtext>)</mtext></math>. Our method employs dynamic programming and uses O(nk)<math><mtext>O</mtext><mtext>(nk)</mtext></math> space, while the best known algorithms for undirected trees require O(n2k)<math><mtext>O</mtext><mtext>(n</mtext><msup><mi></mi><mn>2</mn></msup><mtext>k)</mtext></math> space.
Loading