Questions tagged [sequence]

A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. In a relational database, a sequence is an object that is used to generate unique numbers for a primary key.

A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence.

Sometimes, sequence is used as a generic name for both list, array and set for convenience.

In a , a sequence is an object that is used to generate unique numbers for a .

5959 questions
2
votes
1 answer

Shuffle some sequence of List in Scala

I'm using scala.util.Random, then I know how to shuffle a list. It's very useful to randomize an order inside Array list, for example: val List(a, b, c, d) = Random.shuffle(List(1,2,3,4)) it will result a = 1 b = 3 c = 2 d = 4 the result of a, b,…
Deden Bangkit
  • 598
  • 1
  • 5
  • 19
2
votes
1 answer

Count consecutive values in groups with condition with dplyr and rle

My question is very similar to the one posed below, however I want to add an additional command to return only cases when a sequence has more than 2 consecutive values. How do I count the number of consecutive "success" (i.e. 1 in $consec) when a…
2
votes
1 answer

In python 3.5, when using a argument list as input to subprocess.Popen(), I cannot get correct len(sys.argv)

In experiment_script.py, I use a list as input to subprocess.Popen(). cmd = [r'.\modified_easy.py', training_libsvm_files[training_index], testing_libsvm_files[training_index]] p = subprocess.Popen(cmd, shell = True, # The cmd…
John Smith
  • 201
  • 2
  • 12
2
votes
3 answers

Determine the adjacency of two fibonacci number

I have many fibonacci numbers, if I want to determine whether two fibonacci number are adjacent or not, one basic approach is as follows: Get the index of the first fibonacci number, say i1 Get the index of the second fibonacci number, say i2 Get…
2
votes
1 answer

How to safely convert Hibernate hi/lo to pooled?

Unfortunately, I started a project with @Id @Generated(GenerationTime.INSERT) @GeneratedValue(generator = "hibernate_sequence") @GenericGenerator( name = "hibernate_sequence", strategy =…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
2
votes
2 answers

Javascript validation for checkbox in sequence

first I'm sorry for my bad english language. I'm new with Javascript and I had a problem. My problems are about checkbox validation using javascript, so the first checkbox that I have should checked or show an alert (I have done with this problem,…
re sa
  • 23
  • 6
2
votes
2 answers

How to include decimal numbers in ":" sequence

I have a series of numbers that include both whole numbers and decimals. When I try to subset this list using a series of numbers, it ignores the decimals while subsetting. How do I get the subset range to include decimals? Note: I understand that…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
2
votes
2 answers

R - Subset dataframe based on a repeated sequence

I am trying to subset a data frame based on specific sequence occurring in column v3. A sample of a dataframe: v1 <- c(1:20) v2 <- c(1,1,0,0,1,0,1,1,1,0,1,1,0,0,0,1,1,0,0,0) v3 <- c(4,4,2,3,2,3,2,4,4,2,3,2,3,3,3,4,4,2,3,3) my_df <-…
Amgh
  • 23
  • 4
2
votes
1 answer

Is there a suggested format or approach in TraMineR for sequences with 300+ events in length?

I am dealing with time stamped event sequences that are 300+ events long. This data is similar to web logs, where users hit different pages of a website at different times. One sequence may be one web session and each event is a user action (visit…
jojo
  • 83
  • 7
2
votes
2 answers

collatz conjecture to print the number of objects and the sequence using class

#include using namespace std; class ulam { int num; double prod; int cot; public: ulam(){cot=0;} ulam(int x) { num=x; } void process() …
2
votes
1 answer

How to replicate Stata's "margins at" in R after lm()

From Stata: margins, at(age=40) To understand why that yields the desired result, let us tell you that if you were to type . margins margins would report the overall margin—the margin that holds nothing constant. Because our model is logistic,…
Nata107
  • 41
  • 1
  • 3
2
votes
2 answers

Finding minimal pattern(s) in a sequence

Is there an algorithm to find the minimal sequence(s) within a large sequence? Without any prior knowledge of what those sequences would be? For example, given the sequence {2,3,1,2,3,1}, it would return {2,3,1} Additionally, if there is a…
jekelija
  • 257
  • 4
  • 16
2
votes
0 answers

How to create simple temp table with a sequential list of numbers?

I need to create a temp table in MySQL that simply holds a list of sequential numbers (up to x, specified by me at creation time). Simply: I would think this would be simple to do and useful in several cases, like when you need to join with such a…
dhalia
  • 401
  • 5
  • 21
2
votes
1 answer

Marklogic: How to return a set of items from a sequence randomly (random sample)?

Let us assume that we have a sequence s:=('a','b','c','d','e'). I want to return a random sample consist of three items from this sequence. How to do so in Marklogic? Note: The sequence that I've used is an example. I'm dealing with large sequence.
s.e
  • 271
  • 2
  • 15
2
votes
2 answers

What kind of algorithm is better for unordered sequence matching problem?

If I have two sequences (for example, string) // 01234567890123456789012 a = "AAACDDFFFEE1122VV1VAADD" // 0123456789012345678901 b = "DDFFAA11221DHHVV1VAAFE" I want to know the best substring matching (unordered) from b to a, for…
user470136
  • 21
  • 2