Questions tagged [subsequence]

A subsequence is a sequence obtained by deleting some elements and retaining the relative order of the remaining elements. It is a generalization of substring which contains only consecutive elements of the original sequence.

A subsequence is a sequence obtained by deleting some elements and retaining the relative order of the remaining elements. It is a generalization of substring which contains only originally consecutive elements.

303 questions
0
votes
0 answers

Algorithm- Printing LCS in O(nlogn) complexity

I'm trying to print the longest common subsequence of 2 long long vectors in O(nlogn) worst case time, and I have the following three conditions- 1. Each element in a vector is distinct 2. Each vector is a permutation of the other 3. If the size of…
0
votes
1 answer

Regarding subsequences - CLRS

I am reading chapter 15 from CLRS and came across this definition of a subsequence: A subsequence of a given sequence is just the given sequence with zero or more elements left out. Later it is said that: Each subsequence of X corresponds to a…
babon
  • 3,615
  • 2
  • 20
  • 20
0
votes
1 answer

How to find same elements in a row between 2 arrays using dynaming programming in C - Example

serious problem because i'm finishing my Thesis for Diploma and i can't figure out this last on problem to finish with my project... I create 2 images that I'm explain my problem... If anybody can really help I'll appreciate it. Thanks...
Nakos Kotsanis
  • 180
  • 1
  • 15
0
votes
1 answer

r - Extract subsequences with specific time increments

I have a data frame df. It has several columns, two of them are dates and serial_day, corresponding to the date an observation was taken and MATLAB's serial day. I would like to restrict my time series such that the increment (in days) between two…
Yair Daon
  • 1,043
  • 2
  • 15
  • 27
0
votes
1 answer

identifying common *non-continuous* subsequences representing occurrences

Consider the following dataset: set.seed(50) d = matrix(rbinom(1000, 1, 0.9), ncol = 20) Each row corresponds to an object, and each column corresponds to a measurement of the object. For example, rows could be individuals in a study and columns…
mikeck
  • 3,534
  • 1
  • 26
  • 39
0
votes
1 answer

Split string into two longest palindrome

So I have this string "nmmaddammhelloollehdertr", if we split the string into x = "nmmaddamm" and y = "helloollehdertr" we could find the LPS to be x = "mmaddamm" and y = "helloolleh". We know that this is the biggest palindrome as x has a length of…
0
votes
1 answer

How do I obtain string subsequence indices after counting number of subsequences?

Given the following algorithm to count the number of times a string appears as a subsequence of another and give me the final number, how would I implement a routine to give me the indices of the strings. eg if there are 4 string appearing as a…
Rza
  • 19
  • 1
  • 12
0
votes
1 answer

Longest common subsequence—where is my infinite loop?

I'm trying to implement the longest common subsequence algorithm in Ruby, but I'm getting the stack level too deep error message. I know this probably means I have an infinite loop, but I cannot spot it. Below is my best attempt—where am I going…
achalk
  • 3,229
  • 3
  • 17
  • 37
0
votes
1 answer

Count all Subsequence from string made by F and B which can lead you from start to end point?

Given a line from 0 to n points and starting point x and end point y and string which consists only "F" and "B"(F-forward and B-backward). I need to find all subsequence which can lead from starting point to end point. For example: n=6, x=1, y=2 and…
0
votes
1 answer

Alternate of String.subSequence from Index to Start and Ending Tags

I have a following set of Strings. String s1 = "Some random text followed by timestamp('some data')"; String s2 = "Some extended random tet followed by timestamp('some extra data')"; String s3 = "Some tiny random text followed by timestamp('some…
irshad.ahmad
  • 276
  • 3
  • 9
  • 24
0
votes
1 answer

Debug Longest Increasing Subsequence- Ruby

I'm working on the following problem via Leetcode: Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101],…
segue_segway
  • 1,490
  • 1
  • 22
  • 40
0
votes
0 answers

Algorithm to find max weighted sequence from set of weighted sub-sequence

I encountered a problem which can be summarized as below: Given a set of sequences with weights which are extracted from a n-length sequence Need to find the n-length sequence which is compatible with sub-set of the given sequences and have maximum…
vincent
  • 1
  • 1
0
votes
1 answer

The maximum Value Contiguous Subsequence algorithm

The input to this problem is an array A[1...n] of real numbers. Your need to find out what the highest value is that can be obtained by summing up all numbers of a contiguous subsequence A[i],A[i+1],...A[j] of A. If A does not contain negative…
soapzi
  • 11
  • 1
0
votes
0 answers

Longest Increasing Sub sequence in a range

I have come across a problem where we want to tell the maximum size of the longest increasing sub-sequence. an array A consisting of N integers. M queries (Li, Ri) for each query we wants to find the length of the longest increasing subsequence in…
Danyal Imran
  • 77
  • 11
0
votes
2 answers

Split a data-frame based in ordered multi factorial column

I would like to split a data-frame in a list of data-frames. The reasoning to split it is that we will have always father followed by mother which in turn is followed by offspring. However, these family members might have more than one row (which…
user3091668
  • 2,230
  • 6
  • 25
  • 42