YousefSeyam's blog

By YousefSeyam, 5 days ago, In English

Longest Increasing sub-sequence in an array starting from index i


Below is a method for finding the longest increasing sub-sequence of an array starting from an arbitrary element in the array

consider the following array A = [7 9 3 4 5 1 6 8 2 4]

say we need to find the longest sub-array such that the element Ai > Ai — 1

for example: the sequence [2 5 6 8] is said to be an increasing sequence since if you choose an arbitrary element in this sequence, all the elements after it is strictly greater than it

on the other hand, a sequence like this [3 4 7 1 4] is not an increasing sequence since it violates the previous rule. if i were to choose the number 7 for example, i would find that it's followed by the number 1 which is less than 7.

  • Vote: I like it
  • -17
  • Vote: I do not like it

»
5 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by YousefSeyam (previous revision, new revision, compare).

»
4 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Dude ! There's a difference between sub-array & sub-sequence.

  • »
    »
    4 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    6 6 8 |3 2 4 2 3| 2 4 6 — sub-array 4 |3| |5| 6 |7| 3 4 — sub-sequence

  • »
    »
    3 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i'm only missing around. i just wanted to try out this whole "Blog" thing. I didn't even know it would be out and available for every one to read