Longest Increasing Subsequence (LIS) - O(NlogN) | Searching - Animation - Solutions - inDepth

preview_player
Показать описание
#DataStructures #Animation #Sorted #LIS #Nlgn
Watch this amazing short animation which will give you an overview of how to find the LIS of a given array by applying binary search and reducing the time from O(N^2) to O(NlogN).
Enjoy!

0:00 Problem Statement
0:20 Simulation
Рекомендации по теме
Комментарии
Автор

It will not work.

What if the input was changed to
[10, 9, 2, 5, 3, 7, 101, 6]?

Your algorithm will traverse [10, 9, 2, 5, 3, 7, 101] and find
LIS = [2, 3, 7, 101]

Then it will reach the last element of 6, find 7 in the tail, and replace it with 6.
LIS = [2, 3, 6, 101]

This is not a subsequence.

codyw
Автор

why I am so confusing about this algorithm, it 's will not work probably/
maybe I am wrong!!

hanyK_