@amol True, but the question suggests they are . If they arent then it'll require sorting the array and then binary search for largest index for which a[index] < a[i]+a[j] .. Then required triangles are index-j for looped values i and j. On Friday, 15 June 2012 20:15:26 UTC+5:30, Amol Sharma wrote:sry ignore the last comment for i wanted to say - your algo will work only when the numbers given are consecutive.
On Wednesday, 13 June 2012 22:18:01 UTC+5:30, payel roy wrote: > > > Let's say there are N sides are given. Length of them are like > 1,2,3,4,5,....N. > > How do you determine how many tri-angles can be made out of these N sides? > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/kv8ysNreJt4J. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.