47
 правок
Изменения
→Псевдокод:  Обновлен алгоритм
==== Псевдокод ====
<code>
    '''vector<int>''' LIS('''vector<int>''' <tex>\pi</tex>[n])
        '''PriorityQueue''' B
        '''int''' k = 0
        '''for''' i = 1 '''to''' n
            x = <tex>\pi</tex>[i]
        <font color=darkgreen>// по цепочке от последнего элемента 
        // восстанавливаем НВП</font>
        <font color=blue>'''vector<int>''' result[k]
        '''int''' cur = B.max()
            cur = predecessor[cur]
        '''return''' result</font>
</code>
== Оптимизация до O(n log log k)</tex> ==
=== Основная идея ===
