Questions tagged [lis]

The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible.

The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique.

Longest increasing subsequences are studied in the context of various disciplines related to mathematics, including algorithmics, random matrix theory, representation theory, and physics.

The longest increasing subsequence problem is solvable in time O(n log n), where n denotes the length of the input sequence.

Reference.

120 questions
0
votes
1 answer

Why is false returned before the triggering variable equals the triggering value in Ruby? almostIncreasingSequence Codefights

One of the tools I'm using to improve coding is Codefights. I've been stuck on the same problem for several days now and could use some help figuring it out. Can anyone tell me what I'm doing wrong here? Here are the instructions from…
Lenocam
  • 331
  • 2
  • 17
0
votes
0 answers

Wrong answer on LIS

I am solving a problem on my college judge where i have to all lis sequences. The n is very small so, i am generating all subsets and if they are increasing and of longest length, i am printing it. What's wrong in my code? Or may be any problem with…
0
votes
1 answer

Runtime complexity & correctedness of LIS

function LIS(str1){ return LISUtil(str1, 0); function LISUtil(str1, index){ if(index == str1.length){ return 0; } var min = str1[index], len = 1; for(let i=index+1; i
user2130500
  • 15
  • 1
  • 4
0
votes
0 answers

C++: (LIS)Longest Increasing Subsequence using Segment Tree

Given an array of N elements, I need to find length of longest increasing subsequence for T different values of L and R. I tried segment trees, I'm getting Time Limit Exceeded. using namespace std; int a[1000001],ans[1000001],out; int…
Buckster
  • 41
  • 12
0
votes
0 answers

Dynamic multi column parent header and multi column child in expandable list view

Please give me some idea to make Dynamic multi column parent header and multi column child in expandable list view in android.On arrow click child multi row must me expandaded.where parent and child has dynamic values.as shown in Image…
Rohit Yadbole
  • 65
  • 1
  • 9
0
votes
1 answer

How to prove correctness of the following algo

Problem is to find LIS(Longest Increasing Subsequence) of any given array. Ex. a[]={10,9,7,8,9}; length=3; {7,8,9} So one way of doing in nlogn is Sort the array Take LCS of the the two Resulting is LIS. Now I understood how to do it. But how do…
sandy
  • 509
  • 1
  • 6
  • 23
0
votes
1 answer

number of rotations for a box in the Box Stacking (DP) algorithm is 3 or 6?

I understand the dynamic programming solution to the Box Stacking problem, which tries to find the maximum possible length of a stack that can be formed by a given set of boxes, that can be rotated in any direction, such that the lower box is always…
tubby
  • 2,074
  • 3
  • 33
  • 55
0
votes
1 answer

Segmentation fault in LIS solution for Cracking the Coding interview 11.7

There was a problem in cracking the coding interview -part V Question 11.7 and the solution I am trying to implement here is their solution in Java converted to C++.But I am facing issue of segmentation fault. …
Peter_pk
  • 147
  • 1
  • 9
0
votes
1 answer

while executing loop the error is list indices must be intergers,not tuple

I want to store all the iteration output in a matrix(of size 200x200). While executing the code : got the error at the for t in (T2/Taw)*np.arange(-Taw,Taw-1): i=i+1; j=0; for Fd in (B/Taw)*np.arange(-Taw,Taw-1): j=j+1; …
Geeko
  • 29
  • 7
0
votes
0 answers

Longest non-decreasing sub-sequence in O(nlogn)

This may be a very classical problem of finding longest non-decreasing subsequence in O(nlogn). Just to revise, length of longest non-decreasing subsequence in array A={2 4 2 3 3 5 1} is 5 {2 2 3 3 5}. However, After countless efforts I fail to…
CPPCoder
  • 155
  • 1
  • 1
  • 10
0
votes
1 answer

Largest Increasing SubSequence with O(n^2) using Recursions

LIS :The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to highest Eg: 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 A longest increasing…
0
votes
1 answer

Finding Longest Increasing Sub Sequence in a round table of numbers

I was recently working on the following problem. http://www.codechef.com/problems/D2 The Chef is planning a buffet for the DirectiPlex inauguration party, and everyone is invited. On their way in, each guest picks up a sheet of paper containing a…
Siddharth
  • 9
  • 3
0
votes
1 answer

android listview not showing new added items.if i do keyboard off or on with back key list refreshed

when i hide keyboard with back key on android list is fully working and there is new items that i add. i want to refresh list without using back key to hide keyboard. my code is : lv=(ListView) findViewById(R.id.listView1); strArr=new…
0
votes
2 answers

Ubuntu Trusty 14.04 guest install on Hyper-V 2012 R2 doesn't have appropriate drivers for LIS?

I have recently created a brand new fresh gen 2 virtual machine on hyper-v and installed the recently released ubuntu 14.04 version. Even after apt-get update, upon startup, my Windows server 2012 R2 Hyper-V server complains about downlevel drivers…
user1435663
  • 25
  • 1
  • 1
  • 2
0
votes
2 answers

(LIS) Longest Increasing Subsequence Algorithm

EDIT Finally, I found this "Brute force" method is not right. So I write another two methods to solve the LIS problem. Using LCS on the original array and the sorted array. Time complexity = (n^2). Using DP + Binary search. Time complexity =…
zproject89
  • 225
  • 5
  • 19