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 array
 1, 2, 4,3,4
 
Largest permutation for the elements are as follows
 
Indices       Permutations(Length)
1             - 1(1)
2             - 1,2(2)
3             - 0(0)
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

--~--~---------~--~----~------------~-------~--~----~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to