Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"Firehouse" Problem

Name: Anonymous 2009-01-30 15:51

If you have an undirected, unweighted graph G, and a marked subset of points called 'Firehouses,' is there an O(n+m) algorithm to find every vertex's closes firehouse?

I can only come up with O(n^2) stuff. Although I do like the idea of repeatedly raising the adjacency matrix to a power n, until every vertex has a nonzero entry :P

Name: Anonymous 2009-01-30 20:36

You didn't even specify what n and m are, so I will assume that m = 2^n, in which case you are wanting a O(2^n) algorithm which is simple to find. Good luck.

Name: Anonymous 2009-01-30 21:53

Call the people living at every vertex, ask them what the closest firehouse is. O(n).

Name: Anonymous 2009-01-31 0:01

>>11
Suck my dick. O(n^3).

Name: Anonymous 2009-01-31 0:46

>>12
There's therapy for that now.

Name: Anonymous 2009-01-31 5:24

Use a large megaphone to ask everybody all at once. O(1).

Name: Anonymous 2009-01-31 6:38

let the shit burn. O(0)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List