Tags » LIS

Longest Increasing Subsequence

#include<bits/stdc++.h>
using namespace std;
#define N 1000
int arr[] = {-8, 1, 9, 8, 3, 4, -6, 1, 5, 2};
int dir[N];
vector<int>lis;
int LIS(int n){
    for(int i = 0;i<n;i++){
        int x = lower_bound(lis.begin(),lis.end(),arr[i])-lis.begin();
        if(x==lis.size()){
            lis.push_back(arr[i]);
            dir[i] = lis.size();
        }
        else{
            lis[x] = arr[i];
            dir[i] = x+1;
        }
    }
    cout<<"LIS SIZE :"<<lis.size()<<endl;

}
void printSequence(int n){
    vector<int> ans;
    int x,s=-1;
    for(int i = 0;i<n;i++){
        if(dir[i]>s){
            x = i;
            s = dir[i];
        }
    }
    ans.push_back(arr[x]);
    for(int i = x -1;i>=0;i--){
        if(arr[i]<arr[x] and dir[i]==s-1){
            ans.push_back(arr[i]);
            x = i;
            s = dir[i];
        }
    }
    cout<<"Sequence is: ";
    for(int i = ans.size()-1;i>=0;i--){
        cout<<ans[i]<<" ";
    }
}
int main(){
    int n = sizeof arr/sizeof(int);
    LIS(n);
    printSequence(n);
}

… 12 more words
Programming Interview

I found an interesting sim the other day and my friend and I like to stalk each other around Second Life sometimes so she joined me and we were playing with the poses, some nsfw. 42 more words

Second Life

Documentation in the post-factual society; or what LIS did next (after Brexit)

It has become something of a truism that LIS has rather lost its way. The importance of the information professional role is generally believed to have been diminished by the ready availability of digital information, particularly through Google, Wikipedia and social media, while news from the formal library sector is increasingly of closures and mergers. 1,225 more words

LIS

Book Review: A Storm of Swords (A Song of Ice & Fire) feedly

—-
Book Review: A Storm of Swords (A Song of Ice & Fire)
// Crazy Yet Wise

I can say that I’m proud of myself for finishing this book in less than a month and I can also say that I’ve enjoyed every word and page of this book. 673 more words

LIS

History of the Kuwait National Museum feedly

—-
History of the Kuwait National Museum
// 2:48AM – Everything Kuwait

An invited competition was launched in 1960 for the construction of a museum in Kuwait City.

533 more words
LIS