On 10/26/06, Arunachalam <[EMAIL PROTECTED]> wrote:
Hi,You are given an array A of Length N , 1 <= A[i] <= N , for each valid i. Now you are given an valid index m. Now we need to find the length of the largest permutation starting with 1 which contains A[m].For example given an array1, 2, 4,3,4Largest permutation for the elements are as followsIndices Permutations(Length)1 - 1,2,4,3(4)
2 - 1,2,4,3(4)
3 - 1,2,4,3(4)
4 - 1,2,4,3(4)
5 - 0(0)Now given any of the indices I need the length of the largest permutation.Can anyone suggest me a O(N) solution to this problem?
--
===================================
want to know more about me
http"//ww.livejournal.com/users/arunachalam
--
===================================
want to know more about me
http"//ww.livejournal.com/users/arunachalam
--~--~---------~--~----~------------~-------~--~----~
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-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---
