[algogeeks] Open Path TSP ...

2006-09-15 Thread sam
Greetings! I have problems on the "open path" traveling salesman problem. That is, given a starting point s, an end point d, accompained with n points, to find the shortest path from s to d and all the n cities (just once). Is this a variation of TSP ? Can anyone advise where can i find relat

[algogeeks] Re: Try this ..

2006-09-15 Thread Swadhin Sonowal
main() { int arr[n]= {1,4,2,3,5,...}; long SN = n*(n+1)/2; long SN2 = n*(n+1)*(2*n+1)/6; long Sn = 0, Sn2= 0; long D1= 0, D2= 0; for (int i = 0; i < n ; ++i) { Sn += arr[i]; Sn2 += arr[i]*arr[i]; } D1 = SN - Sn; D2 = SN2 - Sn2; X = (D2 + (D1*D1)) / (2*D1);

[algogeeks] Re: Try this ..

2006-09-15 Thread Swadhin Sonowal
hi this problem is already solver previously. check for "Re: Finding Repeated and Missing Numbers" if X is the missing number and Y is the repeating number. then let S(N) = n*(n+1)/2 sum of all the numbers provided be Sn ler S(N2) = n*(n+1)*(2*n+1)/6 sum of square of all the numbers provided be

[algogeeks] Re: visit trees

2006-09-15 Thread L7
Although, on second thought, depending on how the graph was laid out, this might eliminate more weight (value) than the node itself. You would also have to take into consideration how many nodes (rooms) are actually connected at any one intersection. --~--~-~--~~~---~

[algogeeks] Re: visit trees

2006-09-15 Thread L7
My suggestion would be to start with an adjacency matrix for the graph. Take the highest value eliminate adjacent nodes. Repeat. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to th

[algogeeks] Re: visit trees

2006-09-15 Thread carmelo
the highest possible value of summed rooms with camera --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from thi

[algogeeks] Re: visit trees

2006-09-15 Thread L7
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 >

[algogeeks] visit trees

2006-09-15 Thread carmelo
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