By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

visit trees

P: n/a
imagine to have a k-ary tree, each node is a room and each edge is a
corridor; each room has a value assigned, you must place cameras in
rooms but if a room has an adiacent room with the camera you can't
place the camera inside...you must place the cameras to have the max
value possibile.. how to choose the rooms?

Sep 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
carmelo wrote:
imagine to have a k-ary tree, each node is a room and each edge is a
corridor; each room has a value assigned, you must place cameras in
rooms but if a room has an adiacent room with the camera you can't
place the camera inside...you must place the cameras to have the max
value possibile.. how to choose the rooms?
Speaking of rooms, you got the wrong one. Sorry.

What you want is comp.programming, up two floors, on the left side
across from the elevators. They can help you with your algorithm and
theory problems.

Here , we are mechanics working in the C language. If you had a problem
with some specific C code (standards conformant, if you please. We
don't like homebrew or propriatary extensions) we could help you.

Sorry

- --
Lew Pitcher

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32) - WinPT 0.11.12

iD8DBQFFCsYvagVFX4UWr64RAkRHAKDV9SC0Gq5vzilctmqthz N6JzaUHgCg9Wmb
S3p8+K+45ljDzMekGkIdL3k=
=VORC
-----END PGP SIGNATURE-----

Sep 15 '06 #2

P: n/a

"carmelo" <ca************@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
imagine to have a k-ary tree, each node is a room and each edge is a
corridor; each room has a value assigned, you must place cameras in
rooms but if a room has an adiacent room with the camera you can't
place the camera inside...you must place the cameras to have the max
value possibile.. how to choose the rooms?
Start with room 42. It's bigger. And decide whether you want to use Canon
ELF's or Kodaks. Or for max value, use a Hasselblad.
Sep 15 '06 #3

P: n/a
carmelo wrote:
imagine to have a k-ary tree, each node is a room and each edge is a
corridor; each room has a value assigned, you must place cameras in
rooms but if a room has an adiacent room with the camera you can't
place the camera inside...you must place the cameras to have the max
value possibile.. how to choose the rooms?
A level order traversal of the k-ary tree starting from the root
(i.e.depth 0) and chosing all the nodes from even numbered depths. So
in this case, sum of all the nodes in depth 0, 2, 4 ..., call it x.

Another level-order traversal of the k-ary tree starting from depth 1
and chosing all the nodes from odd numbered depths. So in this case,
sum of all the nodes in depth 1, 3, 5 ..., call it y.

The larger of the 2 values x,y will be your max and it's corresponding
nodes will give you the rooms with cameras in them.

Gokul

Sep 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.