Sunday, May 30, 2010

find the longest increasing subsequence of a given sequence

2 comments:

  1. queue que
    que.in(a[0])
    int length = 1
    foreach a[i] i > 0
    {
    if a[i] >= que.last
    {
    length++
    }
    else
    {
    if length > que.length
    {
    que.clearall
    for j = 0 to lentgh
    que.in(a[i - j])
    }
    length = 0
    }
    }

    ReplyDelete
  2. queue que
    que.in(a[0])
    int length = 1
    foreach a[i] i > 0
    {
    if a[i] >= que.last
    {
    length++
    }
    else
    {
    if length > que.length
    {
    que.clearall
    for j = 0 to lentgh
    que.in(a[i - j])
    }
    length = 0
    }
    }

    ReplyDelete