Questions tagged [sequences]

A sequence is any type for which there is a bijective relation between the integers `0..n` and the elements of the sequence, and the elements may be accessed in the order `0..n`, where `n` is the number of elements in the sequence.

A sequence is any type for which there is a bijective relation between the integers 0..n and the elements of the sequence, and the elements may be accessed in the order 0..n, where n is the number of elements in the sequence.

A sequence may be infinite, in which case, the relation is with the open range 0....

538 questions
23
votes
9 answers

Auto-increment in Oracle without using a trigger

What are the other ways of achieving auto-increment in oracle other than use of triggers?
Lakshmi
  • 1,759
  • 4
  • 18
  • 23
22
votes
2 answers

Is there a way to get pg_dump to exclude a specific sequence?

I want to exclude a sequence from my pg_dump command which is putting the output into a plain file. Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file…
Graham
  • 651
  • 2
  • 10
  • 23
21
votes
9 answers

Given a BST and its root, print all sequences of nodes which give rise to the same bst

Given a BST, find all sequences of nodes starting from root that will essentially give the same binary search tree. Given a bst, say 3 / \ 1 5 the answer should be 3,1,5 and 3,5,1. another example 5 / \ 4 7 / /…
user2892884
  • 329
  • 1
  • 2
  • 5
19
votes
2 answers

What is exactly an overlong form/encoding?

Reading the Wikipedia article on UTF-8, I've been wondering about the term overlong. This term is used various times but the article doesn't provide a definition or reference for its meaning. I would like to know if someone can explain the term and…
nEAnnam
  • 1,246
  • 2
  • 16
  • 22
19
votes
3 answers

Where can I find the time and space complexity of the built-in sequence types in Python

I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online?
Jeremy
  • 1
  • 85
  • 340
  • 366
19
votes
1 answer

Deleting a table in PostgreSQL without deleting an associated sequence

I have a table, foo. For the purposes of a quick upgrade/deploy of my site, I made a new table, tmp_foo, to contain some new data, by doing: create table tmp_foo (like foo including constraints including defaults including indexes); Now each table…
Alison R.
  • 4,204
  • 28
  • 33
18
votes
11 answers

Best practice for shifting a sequence in a circular manner

I have to implement a kind of an array or sequence or list, which supports the cheapest way of circulated forwarding and back winding of elements. See this example: Original sequence: 1 2 3 4 5 Forwarded once: 5 1 2 3 4 Forwarded twice: 4 5 1 2…
noncom
  • 4,962
  • 3
  • 42
  • 70
18
votes
12 answers

Correct way to detect sequence parameter?

I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I don't want it to be restricted to a hardcoded list. In other words, I want to know if the parameter X…
noamtm
  • 12,435
  • 15
  • 71
  • 107
16
votes
2 answers

How to update unique values in SQL using a PostgreSQL sequence?

In SQL, how do update a table, setting a column to a different value for each row? I want to update some rows in a PostgreSQL database, setting one column to a number from a sequence, where that column has a unique constraint. I hoped that I could…
Peter Hilton
  • 17,211
  • 6
  • 50
  • 75
15
votes
5 answers

hibernate creating empty table - hibernate_sequence at startup

So I just downloaded hibernate 5.0.0.1, and I tried my project to it, which is previously using hibernate 4.3. When I insert to the database, it gives me this error: ERROR: could not read a hi value - you need to populate the table:…
lightning_missile
  • 2,821
  • 5
  • 30
  • 58
15
votes
4 answers

What's the best way to write [0..100] in C#?

I'm trying to think of clever, clear, and simple ways to write code that describes the sequence of integers in a given range. Here's an example: IEnumerable EnumerateIntegerRange(int from, int to) { for (int i = from; i <= to; i++) { …
Jay Bazuzi
  • 45,157
  • 15
  • 111
  • 168
15
votes
3 answers

Numbers in Geometric Progression

How can i generate a sequence of numbers which are in Geometric Progression in R? for example i need to generate the sequence : 1, 2,4,8,16,32 and so on....till say a finite value?
Maddy
  • 363
  • 3
  • 6
  • 16
14
votes
2 answers

Why there is no List.skip and List.take?

Why there is no List.skip and List.take? There is of course Seq.take and Seq.skip, but they does not create lists as a result. One possible solution is: mylist |> Seq.skip N |> Seq.toList But this creates first enumerator then a new list from that…
The_Ghost
  • 2,070
  • 15
  • 26
13
votes
3 answers

SQL Server 2012 sequence

I create a table and sequence in order to replace identity in the table I use SQL Server 2012 Express but I get this error while I tried to insert data to the table Msg 11719, Level 15, State 1, Line 2 NEXT VALUE FOR function is not allowed in…
danarj
  • 1,798
  • 7
  • 26
  • 54
12
votes
5 answers

Calling Seq.skip and Seq.take in F#

let aBunch = 1000 let offset = 0 let getIt offset = MyIEnumerable |> Seq.skip aBunch * offset |> Seq.take aBunch |> Seq.iter ( .. some processing ...) Calling getIt() with different offsets eventually gives me an 'Invalid operation'…
Moonlight
  • 545
  • 5
  • 15
1
2
3
35 36