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
0 answers

Number of longest increasing subsequences

I'm trying for a while now to come with an idea to calculate how many longest increasing subsequences there are in a given integer array in the most efficent way. I don't need to find all the subsequences, only how many are they... I'm working with…
user3328621
  • 13
  • 1
  • 5
0
votes
2 answers

Java tablemodel hashmap vs list

I have a custom AbstractTableModel That model stores the data in a HashMap. So for my method for getValueAt(int rowIndex, int columnIndex) I do new ArrayList(data.values()).get(index); However my data has over 2000 entries, so doing this…
Quillion
  • 6,346
  • 11
  • 60
  • 97
0
votes
1 answer

Improving the Longest Increasing Sequence Algorithm

From SPOJ, here is the problem statement. I started off with the normal DP solution, but that was going to take n^2 time and was bound to exceed the time limit. I came across the nlogn solution to the problem and here is the solution for that. The…
Kraken
  • 23,393
  • 37
  • 102
  • 162
-1
votes
1 answer

Read all the words starting from substring

I have csv file in which keywords are given. I have to match all the words starting with the keywords from the text. text = "1 who were randomized 1 1 to daro 600 mg twice daily or matching pbo in addition to adt docetaxel randomization was…
Ad_sh
  • 37
  • 5
-1
votes
2 answers

Sort list multiple key and upper nearest value

How I want to order my list: isRegular = True bold = True italic = True The upper nearest value of weight. In my example, I want the nearest value to 400. My list contains these NamedTuple: class Font(NamedTuple): fontPath: str fontName:…
-1
votes
1 answer

I have a list that returns two values at one position of the array

I have a list that returns two values at one position of the array. In the example is the 0 position of the array c. I want to know how to retrieve the first value and then the second value Thank you
Allanwa
  • 3
  • 2
-1
votes
3 answers

sorting a list using Collections causes errors

i have an object of type MatOfDMAtch and i converted to a list and i want to sort it as shown below using Collections, but when i run the code i receive the below errors. please let me know why i am receiving these errors and how to solve…
Amrmsmb
  • 1
  • 27
  • 104
  • 226
-1
votes
3 answers

C# copy values from array to list

I have following code: for (int c = 0; c < date_old.Length; c++) { for (int d = 0; d < date_new.Length; d++) { newList[c] = data_old[c]; if (date_old[c] == date_new[d]) { newList[c] = data_new[d]; …
uzi42tmp
  • 271
  • 2
  • 9
  • 22
-2
votes
1 answer

How do I print out the specific index?

My code: text = [['Name', 'Surname', '2009']] What I tried to do: text[1]; I want so that the 'Surname' would print out, but I keep getting - IndexError: list index out of range.
lucutes
  • 9
  • 3
-2
votes
1 answer

C# Collections vs Arrays: Longest Increasing Subsequence Benefits

What's the performance penalty that I can expect if I'm using Lists over Arrays to solve the Longest Increasing Subsequence? Will the dynamic nature of Lists improve average performance because we're not dealing with sizes we won't actually…
devadviser
  • 120
  • 1
  • 12
-2
votes
1 answer

How to remove an Object from a file?

How to delete an Object from a file ?? DefaultListModel model = (DefaultListModel) list.getModel(); int selectedIndex = list.getSelectedIndex(); if (selectedIndex != -1) { …
user7
  • 11
  • 1
  • 5
-3
votes
3 answers

Remove element in list in a dictionary from specific keys

I have a dictionary like below: my_dict = {'A' : [1, 2, 3, 4, 5], 'B' : [10, 1, 2, 5, 8], 'C': [6, 5, 3, 1]} I want to remove values less than 3 from "A" and "C" while B remains the same, so the output looks like the below: my_dict = {'A' : [ 3, 4,…
Imran
  • 71
  • 5
-3
votes
1 answer

What is the complexity for std::upper_bound and std::lower_bound for Vector in C++?

What is the complexity of the std::lower_bound and std::upper_bound functions. I know in case of std::set it is log(n), but I have no idea for a std::vector. I was going through an implementation of the Longest Increasing Subsequence using…
-3
votes
1 answer

LIS - Longest Increasing Subsequence Algorithm in PHP O(nlogn)

I can't find anywhere solutions for my problem :(. Can someone help me and find (or write) this algorithm with comments? I can't do it myself. I spent on it at least 3 hours and nothing. BIG Thank you!
Matthew
  • 63
  • 10
-8
votes
1 answer

How to find the maximum value in a list without using Built-in Functions in python?

I'd like to create a function that will print the max value within a list of numbers.
1 2 3 4 5 6 7
8