The problem here is more about finding the most optimal solution and not just solution. Rgds Adi -----Original Message----- From: Sathaiah Dontula Sent: 29/09/2010, 09:25 To: [email protected] Subject: Re: [algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.
I think we can do like this, 1. Sort all the xi's in ascending order -> nlog(n) 2. Then find the longest increasing sequence of yi's -> nlog(n) 3. complexity will be nlog(n). Thanks, Sathaiah Dontula On Tue, Sep 28, 2010 at 11:37 PM, Prashant Kulkarni < [email protected]> wrote: > i think it is similar to finding max in a list O(n) or sorting algorithm > O(n log n) > > -- Prashant Kulkarni > > > > > On Tue, Sep 28, 2010 at 11:33 PM, Rahul Singal <[email protected]>wrote: > >> A possible solution i can think is create a directed graph where each >> vertex is a envelope and edges are from a bigger envelope to smaller >> envelope ( one which can fit in bigger envelope ) . Now the problem is >> reduce to finding longest path in the graph . >> >> Regards >> Rahul >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<algogeeks%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
