4
a 5
To implement the resequencing in table 2, the
state of the art uses a database API (Application
Programming Interface) or an SQL (Structured Query
Language, Bayer, 1970) update statement. The
following pseudocode is an example to illustrate the
database writing activities using an SQL statement
(Nelson, 2018):
Input:
Database table Bookmarks: bookmarks
Attribute Bookmark: bookmark
Attribute Sequence Number: s
SQL Update Statement:
Update bookmarks
Set s = s + 1
Where s >= 1 and s < (Select s
from bookmarks where bookmark = 'f')
Update bookmarks
Set s = 1
Where bookmark = 'f'
The SQL statement above will initiate and perform
four write operations to rearrange the database table
“bookmarks”; three operations will update the data
records “d”, “g” and “b” and one operation will set
“f” to the sequence number 1.
The quantity of necessary write operations to
update the sequence will depend on the position of the
inserted new data record or the updated data record.
The size of the required write operation in “Big O”
notation is O(n) (Wikipedia, 2021). With other words,
a given sequence with n records requires at worst “n”
write operations to perform the rearrangement.
Within comprehensive databases, such
rearrangements might cause numerous read and write
actions, consuming considerable computing capacity.
In the worst-case scenario, all existing data records in
the sequence must be updated, as e.g. when inserting
a new data record in the first position of the sequence.
The implementation of such data access
transactions, in particular via the internet, is usually
complex and time-consuming.
Using the innovative method presented in this
paper, this comprehensive updating can be avoided
since the insertion will not affect the remaining
sequences anymore and the size of the write
operations will be limited to O(1).
3 OPTIONS FOR USER-DEFINED
SEQUENCES WITHOUT THE
NEED OF RESEQUENCING
3.1 The Consideration of Fixed-point
or Floating-point Arithmetic
In theory, it is possible to generate sequence numbers
in fixed-point or floating-point format to avoid the
resequencing (Schäfer, 1989). However, these data
types have limited precision and after certain iteration
the rightmost digits will be skipped, with the effect
that the accuracy and resolution of results might be
affected. This is due to the well-known machine
“overflows” respectively “underflows” that can occur
in electronic fixed- and floating arithmetic.
Furthermore, electronic computers might have
serious performance limitations when fixed-point and
floating-point arithmetic is used (Schmid, 1974).
Therefore, fixed- or floating-point numbers are rarely
used in applications to maintain the user-defined
sequences.
In contrast, the presented alternative method is
based on integer data type that is interpreted as
inverse natural numbers. The inverse natural number
system keeps the original sequence of data records
valid after new data record insertion and edition. The
renumbering is avoided even if two sequence
numbers only differ by 1 and a new data record is
inserted in between.
3.2 The Inverse Natural Number
System
When using the inverse natural numbering system,
resequencing is avoided by interpreting the value of
the sequence number inversely. In this context
inverse means that the maximum value of the number
is absolutely limited to the value of the leftmost digit.
Consequently, the value of a sequence number
decreases as the number of its digits increases. For
example, if the leftmost digit of a number is 9, the
value of this number will never exceed 9, no matter
how many digits are appended at the right of the
number.
With other words, the value of a sequence number
can be reduced by adding further digits to the right of
the existing digits of the number. Consequently, the
sequence number 100 is interpreted as being smaller