title: Find longest increasing sequence
body: <p>You are given a sequence of numbers and you need to find a longest increasing subsequence from the given input(not necessary continuous).</p>
  
  <p>I found the link to this(<a href="http://en.wikipedia.org/wiki/Longest_increasing_subsequence" rel="noreferrer">Longest increasing subsequence on Wikipedia</a>) but need more explanation.</p>
  
  <p>If anyone could help me understand the O(n log n) implementation, that will be really helpful. If you could explain the algo with an example, that will be really appreciated.</p>
  
  <p>I saw the other posts as well and what I did not understand is:
  L = 0
   for i = 1, 2, ... n:
     binary search for the largest positive j ≤ L such that X[M[j]] &lt; X[i] (or set j = 0 if no such value exists)
   above statement, from where to start binary search? how to initialize M[], X[]?</p>