On 01/03/16 11:59, Matthias-Christian Ott wrote:
> I know that this question is not strictly related to SQLite.
> 
> I want to persist a random-access sequence with SQLite. A random-access
> sequence is a queue with random-access to its queued elements. Suppose
> that a random-access sequence [x_0, ..., x_n] has the following operations:
> 
> enqueue([x_0, ..., x_n], x) = [x_0, ..., x_n, x]
> dequeue([x_0, ..., x_n]) = [x_1, ..., x_n]
> lookup([x_0, ..., x_n], i) = x_i
> update([x_0, ..., x_n], i, y) =
>   [x_0, ..., x_(i - 1), y, x_(i + 1), ... x_n]
> length([x_0, ..., x_n]) = n + 1

Thinking a bit more about it, I also need the following operation:

delete([x_0, ..., x_n], i) = [x_0, ..., x_(i - 1), x_(i + 1), ... x_n]

So implementing the data structure with autoincrement does not work anymore.

- Matthias-Christian

Reply via email to