Блог пользователя YousefSeyam

Автор YousefSeyam, 7 дней назад, По-английски

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.

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

»
7 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
6 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    6 дней назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

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

  • »
    »
    6 дней назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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