arrays - How can we assure that a Bitonic sequence will be formed from one longest increasing subsequence and one longest decreasing subsequence? -


for example have array[]={1,3,2,7,4,6,8,9}.

longest increasing subsequence of array[]={1,3,4,6,8,9} , length=6.

longest decreasing subsequence of array[]={3,2} , length=2.

then bitonic subsequence of array[]={1,3,4,6,8,9}? if yes length=6.but length of bitonic subsequence =length of lis + length of lds -1, here not equal.

if no how can prove length of bitonic subsequence=length of lis+length of lds-1

correct me if wrong. thank you.

the formula correct , gives out 6 only... consider lis[](as lis array) , lds[] (as lds array).. when iterate left right reach position lis[index]=6 i.e. lis till array[7] 6.. lds[index=7] 1 (trivially 1 element maximum length of series)... lis[7]+lds[7]-1=(6+1-1)

now proof wanted bitonic sequence... lis[i],lds[i] represents longest increasing / decreasing sequence till i! now, want maximise that's why search on sample space! answer maximum of (lis[i]+lds[i]-1) 0<=i<=n-1 ... that -1 due repeated inclusion of element @ th position!


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -