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
-2
votes
1 answer

How can I find a subsequent trial based on a condition?

I am using R to manipulate a large dataset (dataset) that consists of 20,000+ rows. In my data, I have three important columns to focus on for this question: Trial_Nr (consisting of 90 trials), seconds (increasing in .02 second increments), and…
-2
votes
1 answer

Linear space data-structure supporing subsequence query on a static string

Build a data-stucture from a given string S of length n which supports fast queries for checking whether an input string J of length m is a subsequence of S. S is a static string and pre-processing time of the data-structure can be…
DannyDannyDanny
  • 838
  • 9
  • 26
-2
votes
2 answers

Product of Products of elements of all subsequences of length k of an array

I have been given an array of length of n. I have to find the product of products of elements of all subsequences of length k. For e.g Array -> [1,2,3,4] n=4,k=2 Subsequences -> {1,2} {1,3} {1,4} {2,3} {2,4} {3,4} Products -> …
-2
votes
3 answers

Difference in Output in Java and other Languages in generating subsequences

Update : My question is why do we need BigInteger in Java. Why can't we solve the question directly on the pseudocode as it workis in every other language. This is the pseudocode for generating subsequences of a Array. int[] arr = {1,2,3} ; int…
user9818569
  • 425
  • 1
  • 4
  • 6
-2
votes
1 answer

Find increasing and decreasing subsequence in an array Python

I have a little complicated problem. I have this array [34,33,5,78,50,76,82,95,119,31,49,76] and I need to find all the longest increasing and decreasing subsequences. For example, the longest decreasing subsequence you can find has a lenght of…
Frank
  • 125
  • 1
  • 2
  • 8
-2
votes
1 answer

My program for printing longest palindrome subsequence isn't working, When I run it,console windows stops working after taking input

#include #include int ai, aj; // ai and aj to store the value of i and j respectively int maxx(int a, int b) { // to return max of the two numbers return (a <= b) ? b : a; } void LongestPal(char…
-2
votes
1 answer

Finding boundaries of multiple subsequences in a string

Given a string of length n composed of combinations of A B D characters. Ex-1: AAAABAAAADADDDDADDDBBBBBBDDDDA Threshold of x, a given substring can contain any other contiguous substring of max length x Ex-2: for a subsequence of A in Ex-1,…
aravind ramesh
  • 307
  • 2
  • 15
-3
votes
2 answers

checking if a string is subsequence of another string

Two strings M and W are given, need to check if one is subsequence of another. I tried the following: def filterr(bigStr,smallStr,i): res='' for char in bigStr: if(char in smallStr[i:]): i+=1 res+=char return…
Saif
  • 39
  • 8
-3
votes
1 answer

Finding a subsequence of one string in another string

Finding a subsequence of one string ("hello") in another string: def isSubSequence(string1, string2, m, n): if m == 0: return True if n == 0: return False if string1[m-1] == string2[n-1]: return isSubSequence(string1, string2,…
Kimho14
  • 19
  • 3
-3
votes
1 answer

Longest common sub string and sub sequence

Can anyone clearly explain recursive solutions of Longest common subsequence and longest common substring and the difference between them?
-3
votes
3 answers

How to find the subsequence of the largest sums in C/MIPS?

So the following input in an array would be something like Array: {7 2 5 -3 3 6 -4 1} and the subsequence would be Subseq: : 7 2 5 -3 3 6 and the answer to the largest sum would be 20. So, what exactly is going on here. I am not understanding…
CodeFreak
  • 90
  • 1
  • 2
  • 15
-3
votes
3 answers

Extracting the subsequence of maximum length from a sequence [PYTHON]

I have a sequence of values [1,2,3,4,1,5,1,6,7], and I have to find the longest subsequence of increasing length. However, the function needs to stop counting once it reaches a number lower than the previous one. The answer in this sequence in that…
-3
votes
1 answer

Python: Finding Unique Subsequences of Unique Strings

Edit: To the people that downvoted: I was perfectly clear that I did not want code and that I had already tried it myself. All I was looking for was an explanation of what mathematical process yielded the sample results. First question. I have done…
user3314486
-4
votes
1 answer

Zero Subsequences problem - What's wrong with my C++ solution?

Problem Statement: Given an array arr of n integers, count the number of non-empty subsequences of the given array such that their product of maximum element and minimum element is zero. Since this number can be huge, compute it modulo 10 ^ 9 + 7 A…
hecker
  • 9
  • 4
-4
votes
1 answer

Return an array of strings containing all sub-sequences for s (except the empty string) ordered lexicographically?

I need the code (or snippet of the code for the following problem or hint on how to solve): A sub sequence of string s is obtained by deleting one or more characters from s. The set of sub sequences for string s = abc would be a, ab, ac, abc, b, bc,…
snapGeek
  • 41
  • 1
  • 2
  • 5
1 2 3
20
21