Skip to content

Latest commit

 

History

History

Longest Increasing Subsequence

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

LONGEST INCREASING SUBSEQUENCE

ALGORITHM

input array of size n

lis[n]:= 1,1,1,1,....,1; for i=2...n do for j=1....i-1 do if array[i]>array[j] AND lis[i]<=lis[j] then lis[i]:=lis[j]+1; end end end return MAX(lis[0],lis[1],...,lis[n]);

COMPLEXITY

Complexity

  • Time:
    • Worst Case: formula
    • Average Case: formula
    • Best Case: formula
  • Space:
    • Worst Case: formula