Lower

bounds

on

the

space

requirement

of

a

class

of

geometric

problems

R.

Fessler

Th

Ottmann

P.

Widmayer

Departement

Informatik

ETH

Zentrum

Zurich

Switzerland

October

Abstract

The

minimal

slot

assignment

problem

-LRB-

MSAP

-RRB-

for

a

set

of

horizontal

line

segments

in

the

plane

asks

for

the

computation

of

a

minimal

number

of

storage

locations

for

the

segments

needed

in

a

scanline

algorithm

which

uses

a

semidynamic

skeleton

structure

We

discuss

various

algorithms

for

solving

the

MSAP

and

are

particularly

interested

in

reducing

their

internal

space

requirements

As

main

results

we

derive

linear

space

bounds

for

algorithms

which

solve

the

MSAP

in

such

a

way

that

they

are

allowed

to

access

each

externally

stored

segment

exactly

once

We

present

a

new

technique

for

deriving

lower

space

bounds

for

a

class

of

online

algorithms

for

which

the

online

restriction

results

from

the

assumption

that

not

all

input

data

can

be

held

in

core

Our

results

show

that

the

idea

of

unifying

and

simplifying

a

scanline

algorithm

by

first

computing

a

minimal

slot

assignment

then

constructing

a

semidynamic

skeleton

structure

based

on

the

slot

numbering

and

finally

to

carry

out

the

scanline

algorithm

using

the

semidynamic

structure

is

infeasible

if

the

internal

space

requirement

must

be

of

order

o

-LRB-

n

-RRB-

and

each

segment

can

be

read

only

once

On

leave

from

the

University

of

Freiburg

Categories

E.

F.

F.

I.

Online

algorithms

time

spatial

and

stor

age

restrictions

Currently

there

is

a

lot

of

interest

in

socalled

online

algorithms

that

is

algorithms

where

decisions

have

to

be

made

in

temporal

coherence

with

a

given

input

sequence

without

knowing

the

future

A

typical

example

is

the

online

bin-packing

problem

where

a

sequence

of

objects

of

size

less

than

one

is

presented

one

after

the

other

The

objects

have

to

be

packed

into

bins

of

size

one

and

the

goal

is

to

use

the

smallest

possible

number

of

bins

for

storing

the

objects

The

next

object

has

to

be

stored

immediately

after

it

appears

in

the

input

sequence

Therefore

the

decision

where

to

store

it

-LRB-

in

one

of

the

already

opened

bins

or

in

a

new

one

-RRB-

has

to

be

made

online

i.

e.

only

based

on

the

inputs

seen

and

the

decisions

made

so

far

Once

a

decision

is

made

it

can

not

be

revised

in

the

future

i.

e.

any

rearrangement

of

objects

is

not

allowed

There

are

many

other

problems

with

a

similar

flavor

We

just

mention

the

k-server

problem

first

suggested

in

-LSB-

-RSB-

Online

algorithms

for

solving

those

problems

are

subject

to

a

temporal

constraint

Decisions

have

to

be

made

on

the

past

and

the

algorithms

neither

know

nor

can

influence

the

future

There

is

another

class

of

online

algorithms

which

are

subject

to

a

spatial

rather

than

a

temporal

constraint

Consider

the

motion

planning

problem

for

a

robot

walking

in

an

unknown

terrain

The

robot

can

see

only

some

part

of

its

environment

and

has

to

base

its

decision

where

to

go

next

only

on

what

he

has

seen

so

far

However

the

robot

may

have

influence

on

future

inputs

by

its

current

decisions

See

-LSB-

-RSB-

for

an

example

of

an

algorithm

of

this

kind

Sleator

and

Tarjan

-LSB-

-RSB-

have

introduced

the

concept

of

competitive

analysis

for

online

algorithms

-LRB-

See

also

-LSB-

-RSB-

-RRB-

They

compare

an

online

algorithm

with

the

optimal

offline

algorithm

solving

the

same

problem

rather

than

comparing

any

two

online

algorithms

In

this

paper

we

discuss

examples

of

problems

where

the

online

restriction

results

from

the

fact

that

only

a

limited

amount

of

internal

space

is

available

That

is

the

algorithm

is

confronted

with

the

situation

that

it

is

impossible

to

hold

the

whole

input

in

core

Hence

the

algorithm

has

to

make

decisions

based

on

partial

knowledge

of

relevant

inputs

a

property

which

it

shares

with

online

algorithms

subject

to

a

temporal

or

spatial

constraint

However

it

may

be

possible

that

the

algorithm

has

influence

on

the

order

in

which

inputs

are

read

from

external

store

into

core

To

be

a

bit

more

specific

let

us

discuss

the

online

topological

sorting

problem

as

an

example

for

illustration

A

topological

sort

of

a

directed

acyclic

graph

-LRB-

a

dag

for

short

-RRB-

G

-LRB-

V

E

-RRB-

with

vertex

set

V

and

edge

set

E

V

V

is

a

total

linear

ordering

of

all

its

vertices

such

that

if

G

contains

an

edge

-LRB-

u

v

-RRB-

then

u

appears

before

v

in

the

ordering

Now

assume

that

input

graphs

are

so

large

that

it

is

impossible

to

store

them

as

a

whole

in

core

We

may

however

assume

that

input

graphs

are

stored

externally

and

the

corresponding

outputs

are

also

produced

by

writing

to

an

external

output

medium

More

specifically

let

the

input

of

any

algorithm

for

solving

the

online

topological

sorting

problem

be

a

sequence

of

m

pairs

-LRB-

u

v

-RRB-

representing

edges

of

G

stored

on

a

disc

or

tape

and

assume

that

the

output

is

a

labelling

of

the

vertices

by

integers

s.

t.

label

-LRB-

u

-RRB-

label

-LRB-

v

-RRB-

if

-LRB-

u

v

-RRB-

is

an

edge

of

G

An

algorithm

for

solving

the

online

topological

sorting

problem

may

read

input

pairs

from

external

store

compute

the

edge-labelling

and

write

it

to

the

external

storage

Let

us

assume

that

the

algorithm

is

subject

to

the

constraint

that

it

reads

each

input

pair

exactly

once

and

that

it

can

store

at

most

k

input

pairs

in

core

where

k

m

There

is

no

restriction

on

when

the

algorithm

has

to

assign

labels

to

vertices

it

has

seen

already

-LRB-

as

first

or

second

components

of

an

input

pair

-RRB-

However

once

it

has

assigned

a

label

to

a

vertex

v

-LRB-

v

label

-LRB-

v

-RRB-

-RRB-

is

written

to

external

storage

and

no

future

change

of

label

-LRB-

v

-RRB-

is

possible

anymore

We

give

an

intuitive

argument

why

it

might

be

impossible

to

compute

a

correct

labelling

for

any

given

dag

in

this

way

if

the

internal

storage

capacity

k

is

fixed

and

independent

of

the

number

m

of

edges

of

the

given

dag

even

if

we

assume

that

m

O

-LRB-

n

-RRB-

where

n

is

the

number

of

vertices

of

the

dag

For

assume

on

the

contrary

that

there

is

an

algorithm

A

that

computes

a

correct

labelling

for

any

given

dag

as

input

sequence

If

A

has

read

more

than

k

inputs

it

must

have

forgotten

at

least

one

of

them

More

precisely

assume

that

the

dag

G

-LRB-

V

E

-RRB-

has

node

set

V

k

and

that

A

has

read

k

input

pairs

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

k

k

-RRB-

in

some

order

Then

there

is

at

least

one

i

such

that

the

labelling

computed

by

A

does

not

depend

on

the

pair

-LRB-

i

i

-RRB-

with

i

k

Hence

A

must

compute

the

same

labelling

if

it

reads

the

input

sequence

where

the

pair

-LRB-

i

i

-RRB-

is

replaced

by

the

reverse

pair

-LRB-

i

i

-RRB-

Therefore

the

labelling

computed

by

A

is

not

a

correct

topological

order

either

for

the

dag

G

-LRB-

V

E

-RRB-

with

node

set

V

k

and

edge

set

E

f

-LRB-

i

i

-RRB-

i

k

or

for

the

dag

which

results

from

G

by

replacing

the

edge

-LRB-

i

i

-RRB-

by

the

reverse

edge

In

order

to

turn

this

intuitive

argument

into

a

rigorous

proof

one

has

to

precisely

formalize

the

computational

model

We

will

not

do

this

for

the

online

topological

sorting

problem

discussed

above

but

for

a

geometrical

problem

with

a

very

similar

flavor

We

conjecture

that

along

the

lines

of

arguments

presented

in

the

rest

of

this

paper

one

can

also

show

that

the

online

topological

sorting

problem

for

arbitrary

dags

of

size

n

can

not

be

solved

using

sublinear

space

i.

e.

with

an

algorithm

that

uses

only

o

-LRB-

n

-RRB-

space

In

the

next

section

we

present

the

geometrical

problem

which

we

discuss

in

this

paper

Section

contains

the

formalization

of

the

computational

model

and

Section

a

first

lower

space

bound

based

on

this

model

Section

contains

a

second

lower

space

bound

for

a

more

restricted

class

of

algorithms

In

the

final

Section

we

conclude

with

a

short

discussion

of

the

results

and

some

open

problems

Scan

line

algorithms

skeleton

structures

and

the

slot

assignment

problem

Scanline

also

called

plane-sweep

algorithms

for

solving

geometrical

problems

have

the

advantage

that

it

is

typically

not

necessary

to

store

all

input

data

in

core

In

most

cases

it

is

sufficient

to

store

the

currently

active

objects

i.

e.

the

objects

currently

cut

by

the

scanline

Beyond

that

a

set

of

problem

specific

data

is

stored

and

maintained

during

the

sweep

-LRB-

in

the

sweep

history

structure

-RRB-

which

is

also

usually

much

smaller

than

the

size

of

the

whole

input

This

is

the

main

reason

why

plane

-LCB-

sweep

algorithms

are

attractive

for

solving

geometrical

problems

occurring

in

VLSI-design

see

-LSB-

-RSB-

for

a

more

profound

motivation

For

a

general

introduction

into

plane-sweep

see

-LSB-

-RSB-

Plane

-LCB-

sweep

solutions

for

geometrical

problems

often

go

hand

in

hand

with

the

use

of

semidynamic

skeleton

structures

A

semidynamic

skeleton

structure

consists

of

an

initially

empty

skeleton

which

is

then

dynamically

filled

during

the

sweep

and

provides

room

for

all

active

objects

encountered

during

the

sweep

ordered

along

the

scanline

They

support

the

same

operations

as

their

fully

dynamic

counterparts

Segment

interval

priority

search

trees

segment

-LCB-

range

segment

-LCB-

segment

-LCB-

trees

and

others

are

a

few

examples

of

structures

existing

in

both

variants

Semidynamic

skeleton

structures

have

the

advantage

that

they

are

not

only

conceptually

easier

to

understand

but

also

have

simpler

maintenance

algorithms

On

the

other

hand

it

is

a

serious

drawback

of

these

structures

that

they

typically

have

size

linear

in

the

number

of

line

segments

in

the

problem

at

hand

Hence

the

construction

of

space

-LCB-

economical

skeleton

structures

is

a

desirable

goal

which

might

please

both

practitioners

and

theoreticians

alike

A

crucial

step

in

the

construction

of

those

structures

is

the

solution

of

a

problem

which

has

been

called

the

minimal

slot

assignment

problem

-LRB-

MSAP

-RRB-

see

-LSB-

-RSB-

It

can

be

stated

as

follows

Given

a

set

of

n

nonoverlapping

horizontal

line

segments

in

the

plane

find

the

smallest

positive

integer

m

which

satisfies

the

condition

that

the

segments

can

be

assigned

slots

in

the

range

m

such

that

the

total

order

of

line

segments

at

each

scanline

position

equals

the

total

order

given

by

their

slot

assignments

A

solution

of

the

MSAP

should

not

only

determine

the

minimal

number

m

of

slots

required

but

also

assign

labels

-LRB-

slot

numbers

-RRB-

to

the

given

input

segments

The

main

problem

which

has

been

left

open

in

-LSB-

-RSB-

is

the

question

whether

a

minimal

slot

assignment

for

line

segments

can

be

computed

in

sublinear

space

As

stated

above

the

problem

is

not

formulated

precisely

enough

for

a

rigorous

answer

In

particular

any

negative

answer

requires

a

careful

reasoning

about

the

underlying

computational

model

In

this

section

we

will

discuss

four

possible

solutions

of

MSAP

based

on

different

assumptions

Algorithm

Let

us

assume

first

that

the

input

segments

are

stored

externally

in

left-to-right

order

i.

e.

sorted

according

to

increasing

left

endpoints

We

assume

that

the

segments

are

accessible

in

this

order

from

external

store

For

this

first

solution

we

additionally

assume

that

we

have

direct

access

to

the

externally

stored

elements

i.

e.

once

we

have

read

an

input

segment

we

know

its

external

address

and

can

attach

a

slot

number

to

a

stored

segment

at

any

time

without

destroying

the

external

storage

order

Based

on

these

assumptions

we

can

easily

solve

the

MSAP

using

only

O

-LRB-

-RRB-

space

by

the

following

multiple

sweep

algorithm

Sweep

m

times

over

the

set

of

inputs

during

the

i-th

left-to-right

scan

slot

number

i

is

attached

to

all

segments

which

consistently

fit

into

the

i-th

slot

-LRB-

i

m

-RRB-

These

segments

are

determined

by

scanning

the

segments

in

external

storage

order

ignoring

all

segments

which

have

already

obtained

a

slot

number

and

maintaining

the

currently

topmost

segment

-LRB-

without

a

slot

number

-RRB-

Whenever

an

input

segment

is

read

from

external

store

whose

left

endpoint

is

to

the

right

of

the

right

endpoint

of

the

currently

topmost

segment

S

slot

number

i

can

be

attached

to

S

This

multiple

sweep

algorithm

with

direct

access

to

the

externally

stored

segments

solves

the

MSAP

in

time

O

-LRB-

mn

-RRB-

the

algorithm

uses

only

O

-LRB-

-RRB-

internal

space

Algorithm

Next

let

us

assume

that

we

have

only

sequential

access

to

the

externally

stored

segments

Think

of

a

tape

which

holds

the

input

segments

in

left-to-right

order

according

to

their

left

endpoints

Access

to

input

segments

is

possible

in

sequential

read-only

mode

Attaching

a

slot

number

to

a

segment

is

difficult

if

not

impossible

because

it

may

require

to

rewind

the

tape

use

a

second

tape

for

intermediate

storage

and

to

partially

copy

the

input

tape

Of

course

we

may

nevertheless

again

determine

the

respective

topmost

segments

which

have

not

yet

obtained

a

slot

number

and

attach

the

respective

next

slot

number

to

them

For

that

purpose

we

first

read

the

segments

in

left-to-right

order

from

external

store

and

always

maintain

the

topmost

-LRB-

unnumbered

-RRB-

segment

Because

we

do

not

know

whether

or

not

a

segment

is

topmost

before

we

have

passed

its

right

endpoint

we

store

always

the

currently

active

segments

in

core

and

write

a

segment

to

a

separate

external

sto

re

-LRB-

a

second

tape

say

-RRB-

once

the

scan

has

passed

its

right

endpoint

Now

assume

that

we

can

use

the

output

tape

as

input

tape

for

the

next

scan

which

will

be

carried

out

in

the

reverse

direction

That

is

we

assume

that

we

can

read

the

segments

in

decreasing

order

sorted

according

to

their

right

endpoints

As

before

we

can

determine

the

segments

which

fit

into

the

next

slot

and

at

the

same

time

produce

an

output

which

can

be

used

as

input

for

the

next

scan

in

the

reverse

direction

Thus

by

carrying

out

m

sweeps

back

and

forth

using

two

tapes

which

can

be

sequentially

read

from

both

ends

we

can

solve

the

MSAP

in

time

O

-LRB-

m

n

log

C

-RRB-

and

internal

space

O

-LRB-

C

-RRB-

Here

C

is

the

so

called

cross

section

number

that

is

the

maximum

number

of

segments

cut

by

the

vertical

scanline

when

sweeping

over

the

n

input

segments

For

we

maintain

during

the

sweep

the

set

of

at

most

O

-LRB-

C

-RRB-

currently

active

line

segments

without

a

slot

number

and

store

them

sorted

according

to

their

right

endpoints

-LRB-

left

endpoints

-RRB-

when

sweeping

in

left-toright

-LRB-

right-to-left

-RRB-

direction

Remarks

In

many

applications

in

particular

in

VLSI

design

we

may

assume

that

O

-LRB-

C

-RRB-

O

-LRB-

pn

-RRB-

if

n

is

the

number

of

input

segments

But

nothing

is

known

about

the

minimal

number

m

of

slots

required

In

most

applications

computing

the

slot

assignment

is

just

a

preprocessing

step

for

building

a

semidynamic

skeleton

structure

of

size

O

-LRB-

m

-RRB-

which

will

be

used

in

a

scanline

algorithm

for

solving

a

more

difficult

problem

This

of

course

pays

off

only

if

m

is

not

too

large

m

O

-LRB-

pn

-RRB-

is

certainly

acceptable

but

m

-LRB-

n

-RRB-

is

not

Furthermore

the

time

required

to

compute

the

slot

assignment

by

an

algorithm

like

the

algorithm

sketched

above

may

be

not

acceptable

If

we

assume

that

we

have

sequential

access

but

are

not

allowed

to

carry

out

back

and

forth

sweeps

we

have

to

rearrange

the

segments

after

each

scan

such

that

the

input

for

the

next

scan

is

again

sorted

with

respect

to

increasing

x-values

on

external

store

Assuming

that

this

is

possible

efficiently

using

not

too

much

internal

space

we

can

obviously

solve

the

MSAP

by

carrying

out

m

sweeps

in

only

one

direction

We

state

it

as

an

open

problem

whether

the

rearrangement

of

the

input

segments

after

each

sweep

of

the

algorithm

which

carries

out

multiple

sweeps

in

one

direction

can

be

avoided

A

bit

more

generally

stated

the

question

is

the

following

Assume

that

n

input

segments

are

stored

externally

according

to

increasing

x-values

of

their

left

endpoints

and

that

m

is

the

minimal

slot

number

required

for

the

given

input

Is

it

possible

to

compute

a

slot

assignment

using

O

-LRB-

C

-RRB-

space

-LRB-

C

the

cross

section

number

-RRB-

and

time

O

-LRB-

n

m

log

C

-RRB-

Algorithm

It

is

easy

to

see

that

we

can

avoid

rearranging

the

segments

after

the

i-th

sweep

in

order

to

restore

the

correct

x-order

of

segments

if

we

allow

a

redundant

storage

of

the

segments

and

carry

out

back

and

forth

sweeps

Assume

that

each

segment

appears

twice

in

the

ordered

input

se

quence

on

external

store

first

at

the

position

of

its

left

endpoint

and

second

at

the

position

of

its

right

endpoint

For

assigning

slot

numbers

carry

out

pairs

of

left-to-right

and

right-to-left

sweeps

During

the

i-th

pair

of

sweeps

the

input

is

first

scanned

from

left-to-right

and

slot

number

i

is

assigned

to

a

segment

when

it

becomes

inactive

That

is

slot

number

i

is

attached

to

a

segment

when

the

scanline

has

reached

the

right

endpoint

of

the

segment

and

no

unnumbered

segment

above

it

has

been

detected

during

the

time

when

the

segment

was

active

Because

we

have

to

maintain

only

the

topmost

currently

active

nonnumbered

segments

during

the

left-to-right

scan

time

at

most

O

-LRB-

n

-RRB-

and

internal

space

O

-LRB-

-RRB-

is

sufficient

for

the

i-th

left-to-right

scan

After

completion

of

the

i-th

left-to-right

scan

the

input

is

scanned

again

from

right-to-left

-LRB-

in

decreasing

x-order

-RRB-

During

this

sweep

we

meet

first

the

endpoints

of

segments

which

have

just

obtained

-LRB-

by

the

preceeding

left-toright

scan

-RRB-

slot

number

i

and

therefore

we

can

attach

the

same

number

i

to

the

respective

starting

points

of

segments

-LRB-

Observe

that

segments

obtaining

slot

number

i

do

not

overlap

hence

the

right-to-left

scan

can

be

carried

out

using

only

constant

internal

space

-RRB-

After

completion

of

the

i-th

right-to-left

scan

we

are

ready

for

the

next

pair

of

sweeps

without

any

rearrangement

of

segments

The

time

complexity

of

this

algorithm

is

O

-LRB-

m

n

-RRB-

Algorithm

In

-LSB-

-RSB-

an

algorithm

has

been

presented

which

computes

the

minimal

slot

assignment

in

optimal

time

O

-LRB-

n

log

n

-RRB-

and

internal

space

O

-LRB-

n

-RRB-

The

algorithm

presupposes

that

the

input

segments

are

sorted

and

stored

externally

according

to

decreasing

y-values

and

can

be

read

in

this

order

from

external

store

into

internal

memory

We

will

show

in

this

paper

that

the

space

requirement

of

any

such

algorithm

is

-LRB-

n

-RRB-

even

if

the

algorithm

knows

the

number

n

of

segments

in

advance

and

may

read

the

input

segments

in

any

order

from

external

store

The

above

observations

show

that

there

is

a

tradeoff

between

time

space

input

access

mode

and

output

production

when

solving

the

slot

assignment

problem

Because

we

do

not

take

the

external

space

requirement

into

account

we

have

expressed

the

time

and

space

complexity

of

the

algorithms

discussed

so

far

in

terms

of

n

the

number

of

input

segments

and

not

in

terms

of

the

total

length

of

their

description

Similarly

the

internal

space

requirement

ignores

the

fact

that

storing

a

single

segment

in

core

from

a

set

of

n

segments

requires

-LRB-

log

n

-RRB-

space

Taking

these

facts

into

account

we

can

summarize

the

characteristics

of

the

discussed

algorithms

for

computing

a

minimal

slot

assignment

by

the

following

table

Algorithm

Algorithm

Algorithm

Algorithm

number

of

sweeps

m

m

external

storage

x-order

x-order

x-order

y-order

order

of

left

of

left

of

left

and

endpoints

right

end

right

endpoints

points

external

access

direct

sequential

sequential

sequential

mode

external

space

n

n

internal

space

O

-LRB-

-RRB-

O

-LRB-

C

-RRB-

O

-LRB-

-RRB-

O

-LRB-

n

-RRB-

time

O

-LRB-

mn

-RRB-

O

-LRB-

mn

log

C

-RRB-

O

-LRB-

mn

-RRB-

O

-LRB-

n

log

n

-RRB-

The

ultimate

goal

may

be

to

find

an

algorithm

which

inspects

each

segment

at

most

a

constant

number

of

times

and

uses

space

O

-LRB-

C

-RRB-

and

time

O

-LRB-

n

log

n

-RRB-

The

time

bound

O

-LRB-

n

log

n

-RRB-

corresponds

to

the

time

bounds

obtained

for

optimal

offline

algorithms

used

in

the

analysis

of

competitive

online

algorithms

Unfortunately

we

were

unable

to

achieve

this

goal

It

should

be

noted

once

again

that

we

have

tacitly

assumed

that

an

input

segment

can

be

stored

using

constant

space

This

unit-cost-model

is

the

usual

model

in

most

computational

geometry

algorithms

but

it

is

not

reasonable

if

n

is

really

large

Then

we

need

-LRB-

log

n

-RRB-

space

for

each

segment

in

order

to

store

it

either

externally

or

in

core

Thus

we

have

to

multiply

the

space

requirements

for

all

algorithms

discussed

in

this

section

by

a

factor

of

log

n

Our

lower

bound

proofs

in

the

next

sections

will

be

based

on

similar

assumptions

That

is

we

determine

lower

bounds

for

the

space

requirement

of

algorithms

in

terms

of

n

the

number

of

inputs

and

not

in

terms

of

the

total

length

of

input

descriptions

The

computational

model

Now

we

investigate

the

minimal

amount

of

internal

space

required

for

a

certain

class

of

algorithms

in

order

to

calculate

a

minimal

slot

assignment

for

a

given

set

of

n

horizontal

line

segments

in

the

plane

We

want

to

derive

an

-LRB-

n

-RRB-

internal

space

bound

for

every

algorithm

of

the

class

which

is

able

to

compute

a

minimal

slot

assignment

for

the

given

set

of

n

segments

This

requires

to

formalize

the

class

of

algorithms

the

input

and

output

format

and

the

access

mode

Hyp

The

input

is

a

set

of

n

segments

stored

off-line

in

a

separate

and

addressible

memory

which

we

will

call

external

memory

We

assume

that

the

addresses

are

natural

numbers

that

every

segment

is

stored

in

one

address

and

that

the

n

segments

fill

up

the

first

n

addresses

whereas

any

remaining

addresses

are

left

empty

Hyp

The

algorithm

is

allowed

to

know

the

number

n

of

segments

in

advance

-LRB-

either

from

a

pre-calculation

or

from

an

additional

input

to

the

internal

memory

-RRB-

Hyp

The

algorithm

reads

every

input

segment

from

the

external

memory

exactly

once

-LRB-

A

simple

consideration

shows

that

it

has

to

read

every

input

segment

at

least

once

-RRB-

Hyp

There

is

no

restriction

in

producing

the

output

More

precisely

this

means

Between

any

two

consecutive

readings

of

input

segments

the

algorithm

calculates

the

slot-assignment

of

an

arbitrary

number

of

segments

-LRB-

may

be

at

all

-RRB-

and

writes

the

result

as

output

to

external

memory

If

m

is

the

minimal

number

of

slots

required

we

will

not

assume

that

the

algorithm

must

use

exactly

the

slot

numbers

m.

Assigning

any

slots

from

a

totally

ordered

universe

is

sufficient

under

the

assumption

that

we

do

not

use

extremely

large

numbers

to

circumvent

the

problem

All

we

require

is

that

the

number

of

different

slots

assigned

by

the

algorithm

is

minimal

The

slot

names

can

then

be

normalized

to

the

integers

m

in

a

postprocessing

step

which

is

not

considered

to

be

a

part

of

the

algorithm

solving

the

slot

assignment

problem

Our

assumptions

Hyp

imply

that

the

storage

for

the

input

and

output

data

itself

is

not

taken

into

account

only

the

space

needed

for

data

held

or

produced

during

the

computation

of

the

output

is

accounted

for

First

we

give

precise

definitions

of

some

concepts

already

used

in

previous

sections

We

assume

that

all

start

and

endpoints

of

segments

belong

to

a

discrete

countable

universe

which

is

for

the

sake

of

simplicity

the

set

of

integers

Furthermore

we

assume

that

each

segment

occurs

at

most

once

in

any

input

sequence

Moreover

we

suppose

that

segments

are

pairwise

disjoint

Definition

-LRB-

i

-RRB-

A

segment

is

a

triple

oe

-LRB-

y

-RRB-

of

integers

such

that

-LRB-

ii

-RRB-

foe

j

oe

is

a

segmentg

is

called

the

input

alphabet

-LRB-

Every

input

sequence

stored

externally

is

encoded

as

a

word

of

However

not

all

words

in

are

considered

to

be

legal

input

sequences

-RRB-

Furthermore

n

denotes

the

subset

of

that

consists

of

words

of

length

n

and

the

i-th

letter

of

S

n

-LRB-

i

n

-RRB-

is

denoted

by

S

-LRB-

i

-RRB-

S

-LRB-

i

-RRB-

is

undefined

if

i

jSj

where

jSj

denotes

the

length

of

the

word

S

An

input

sequence

S

is

called

legal

if

for

all

i

j

i

j

n

the

segments

S

-LRB-

i

-RRB-

and

S

-LRB-

j

-RRB-

have

no

point

in

common

From

now

on

we

will

consider

only

legal

input

sequences

and

therefore

omit

the

adjective

legal

when

talking

about

input

sequences

-LRB-

iii

-RRB-

Let

be

a

countable

totally

ordered

set

-LRB-

The

sets

of

-LRB-

positive

-RRB-

integers

or

rational

numbers

are

possible

choices

for

-RRB-

is

called

the

set

of

slots

Let

OE

be

the

total

linear

order

defined

on

f

-LRB-

oe

ffi

-RRB-

j

oe

is

a

segment

ffi

g

is

called

the

output

alphabet

ffi

will

be

called

the

slot

assigned

to

oe

if

-LRB-

oe

ffi

-RRB-

is

a

letter

of

the

output

Definition

A

slot

assignment

belonging

to

an

input

sequence

S

is

a

map

S

foe

j

oe

is

a

segment

of

Sg

such

that

the

following

properties

-LRB-

i

-RRB-

and

-LRB-

ii

-RRB-

hold

-LRB-

i

-RRB-

Consider

for

an

arbitrary

x

IR

the

set

foe

-LRB-

y

-RRB-

j

x

oe

segment

of

Sg

of

segments

cut

by

the

vertical

line

at

x

Then

the

yorder

of

segments

in

this

set

along

the

vertical

line

is

compatible

with

the

total

order

OE

of

slots

assigned

to

the

segments

in

the

set

i.

e.

if

oe

-LRB-

y

-RRB-

and

-LRB-

-RRB-

are

two

segments

from

this

set

and

y

then

S

-LRB-

oe

-RRB-

OE

S

-LRB-

-RRB-

-LRB-

Note

that

y

is

impossible

because

we

assume

that

any

two

input

segments

are

pairwise

disjoint

-RRB-

-LRB-

ii

-RRB-

The

set

f

S

-LRB-

oe

-RRB-

j

oe

is

a

segment

of

Sg

has

minimal

cardinality

its

cardinality

is

called

the

minimal

slot

number

and

denoted

by

mS

or

simply

by

m

if

it

is

clear

to

which

input

sequence

it

belongs

Algorithms

for

solving

the

slot

assignment

problem

will

be

identified

with

their

sequences

of

computational

steps

carried

out

on

the

given

input

se

quences

We

consider

only

deterministic

algorithms

that

is

the

respective

next

computational

step

is

determined

completely

by

the

state

of

the

algorithm

and

the

next

input

read

from

external

store

no

randomization

is

allowed

The

states

include

everything

that

the

algorithm

can

store

internally

during

the

computation

Therefore

the

state

set

is

not

assumed

to

be

fixed

but

may

grow

with

the

length

of

the

input

sequence

We

will

finally

argue

that

the

growth-rate

must

be

at

least

exponentional

in

n

if

the

algorithm

is

able

to

correctly

compute

a

minimal

slot

assignment

for

all

input

sequences

of

length

n.

This

in

turn

will

require

at

least

linear

internal

space

used

by

the

algorithm

Note

that

the

algorithm

may

know

the

length

n

of

the

input

sequence

in

advance

Hence

the

sequence

of

states

may

depend

on

the

total

length

of

the

input

sequence

and

not

only

on

the

inputs

seen

until

a

certain

stage

In

order

to

formalize

our

intuition

we

start

with

Definition

An

algorithm

of

class

C

is

a

collection

of

quadruples

-LRB-

Q

Q

IN

ffi

Q

Q

Q

-RRB-

one

quadruple

for

every

set

n

of

input

words

of

length

n.

-LRB-

Note

that

for

reasons

of

simplicity

our

notation

does

not

distinguish

the

different

quadruples

of

the

collection

depending

on

the

different

values

of

n.

-RRB-

Furthermore

-LRB-

i

-RRB-

The

elements

of

the

set

Q

are

called

the

-LRB-

internal

-RRB-

states

of

the

algorithm

The

element

is

the

distinguished

initial

state

of

the

algorithm

-LRB-

ii

-RRB-

The

map

is

called

the

address

map

and

-LRB-

q

-RRB-

is

the

external

address

of

the

segment

that

the

algorithm

will

read

when

being

in

the

state

q.

-LRB-

iii

-RRB-

The

map

ffi

is

called

transition

function

of

the

algorithm

This

means

that

the

algorithm

being

in

the

state

q

and

reading

the

letter

oe

from

the

input

will

change

to

the

state

ffi

-LRB-

oe

q

-RRB-

-LRB-

iv

-RRB-

The

map

is

called

output

function

of

the

algorithm

meaning

that

it

will

write

the

word

-LRB-

q

-RRB-

on

the

output

tape

when

being

in

the

state

q.

-LRB-

Recall

that

according

to

Hyp

the

algorithm

may

produce

an

arbitrary

word

over

the

output

alphabet

not

only

just

a

single

letter

-RRB-

It

is

useful

to

extend

the

domain

of

the

maps

ffi

from

the

input

alphabet

to

the

set

of

all

input

strings

Definition

For

every

quadruple

-LRB-

Q

Q

IN

ffi

Q

Q

Q

-RRB-

we

define

the

induced

quadruple

-LRB-

Q

IN

IN

ffi

Q

-RRB-

recursively

as

follows

ffi

-LRB-

S

-RRB-

ffi

-LRB-

r

S

-RRB-

ffi

-LRB-

S

-LRB-

-LRB-

ffi

-LRB-

r

S

-RRB-

-RRB-

-RRB-

ffi

-LRB-

r

S

-RRB-

-RRB-

-LRB-

r

S

-RRB-

-LRB-

ffi

-LRB-

r

S

-RRB-

-RRB-

-LRB-

r

S

-RRB-

-LRB-

ffi

-LRB-

r

S

-RRB-

-RRB-

The

maps

ffi

and

are

called

the

induced

maps

-LRB-

S

-RRB-

-LRB-

S

-RRB-

is

the

access-order

whereas

S

-LRB-

-RRB-

S

-LRB-

jSj

-RRB-

is

the

external

storage

order

of

the

segments

in

input

sequence

S.

Finally

we

are

able

to

formalize

the

class

of

algorithms

to

be

considered

in

this

section

Definition

An

algorithm

of

class

C

is

an

algorithm

of

class

if

for

every

-LRB-

legal

-RRB-

S

the

induced

map

is

a

bijection

from

jSjg

fSg

onto

jSjg

-LRB-

with

jSj

being

the

number

of

segments

of

S

-RRB-

This

means

that

each

segment

of

an

input

sequence

S

is

read

exactly

once

from

external

store

We

do

not

require

that

the

access

order

coincides

with

the

storage

order

of

segments

on

external

memory

Reading

segments

in

storage

order

is

a

special

case

which

can

be

subsumed

as

follows

into

the

above

framework

Choose

Q

for

some

define

-LRB-

q

-RRB-

-LRB-

-LRB-

i

-RRB-

-RRB-

i

for

each

q

-LRB-

i

-RRB-

Q

i

It

is

obvious

that

the

class

is

precisely

the

formalization

of

the

class

of

algorithms

given

intuitively

by

the

hypothesis

Hyp

above

We

are

now

able

to

define

precisely

what

it

means

that

an

algorithm

solves

the

slot

assignment

problem

for

a

certain

class

of

inputs

We

will

consider

only

reasonable

sets

of

inputs

where

the

space

requirement

to

store

the

segments

is

determined

by

the

number

of

segments

and

not

by

a

pathological

choice

of

their

coordinates

-LRB-

Choosing

the

coordinate

values

of

the

n

segments

so

large

that

it

is

impossible

to

denote

them

with

numbers

of

length

O

-LRB-

log

n

-RRB-

is

an

example

of

a

pathological

choice

-RRB-

Recall

that

we

assume

the

unit

cost

model

which

says

that

external

or

internal

space

O

-LRB-

n

-RRB-

is

sufficient

to

store

n

segments

No

further

restriction

on

the

input

sets

is

imposed

That

is

an

input

set

is

just

an

arbitrary

subset

of

Definition

An

algorithm

of

class

C

is

called

a

slot-assignment

algorithm

For

every

input

sequence

S

the

relation

given

by

the

set

of

all

pairs

-LRB-

oe

i

-RRB-

being

letters

of

the

output

word

-LRB-

S

-RRB-

-LRB-

n

S

-RRB-

n

jSj

defines

a

-LRB-

minimal

-RRB-

slot-assignment

belonging

to

S.

Let

Iy

-LRB-

Iy

M

resp

-RRB-

denote

the

class

of

all

input

sets

with

all

their

segments

being

sorted

with

respect

to

the

y-coordinate

-LRB-

and

with

mS

M

for

every

input

sequence

S

resp

-RRB-

In

this

section

we

are

interested

in

algorithms

which

are

able

to

solve

the

slot-assignment

problem

for

input

sets

belonging

to

one

of

these

two

classes

That

is

we

restrict

ourselves

to

input

sequences

where

the

external

storage

order

coincides

with

the

y-order

of

segments

That

is

for

all

i

the

y-value

of

segment

S

-LRB-

i

-RRB-

the

y

value

of

segment

S

-LRB-

i

-RRB-

Note

that

we

do

not

assume

that

the

external

storage

order

coincides

with

the

access

order

The

latter

one

is

determined

by

the

function

of

an

algorithm

under

consideration

We

use

the

following

abbreviation

sr

-LRB-

S

-RRB-

f

-LRB-

t

S

-RRB-

j

t

r

sg

for

all

r

s

jSj

If

s

r

then

sr

-LRB-

S

-RRB-

That

is

sr

-LRB-

S

-RRB-

is

the

set

of

external

addresses

of

the

segments

that

the

algorithm

will

read

after

having

read

r

segments

and

until

having

read

s

segments

or

equivalently

after

having

reached

the

r-th

state

and

until

reaching

the

s-th

state

Notice

also

that

j

sr

-LRB-

S

-RRB-

j

s

r

because

each

segment

is

read

exactly

once

A

first

lower

bound

As

immediate

consequences

of

the

definitions

given

in

the

previous

section

we

provide

the

following

two

lemmata

needed

as

tools

in

order

to

prove

Theorem

Lemma

Let

S

n

be

two

inputs

of

length

n

let

a

b

a

b

n

n

and

let

be

given

an

algorithm

of

class

C

such

that

-LRB-

i

-RRB-

ffi

-LRB-

a

S

-RRB-

ffi

-LRB-

-RRB-

-LRB-

ii

-RRB-

For

all

k

ba

-LRB-

S

-RRB-

-LRB-

-RRB-

it

is

true

that

S

-LRB-

k

-RRB-

-LRB-

k

-RRB-

Then

it

holds

that

-LRB-

i

-RRB-

-LRB-

a

t

S

-RRB-

-LRB-

t

-RRB-

for

all

t

j

ba

-LRB-

S

-RRB-

j

b

a

and

if

both

sides

are

defined

-LRB-

ii

-RRB-

ffi

-LRB-

a

t

S

-RRB-

ffi

-LRB-

t

-RRB-

for

all

t

j

ba

-LRB-

S

-RRB-

j

and

if

both

sides

are

defined

-LRB-

This

means

that

the

algorithm

after

having

read

r

segments

only

depends

on

the

state

that

it

has

reached

and

on

the

segments

that

it

will

read

afterwards

-RRB-

Proof

Using

definition

we

prove

by

induction

on

t

t

ffi

-LRB-

a

t

S

-RRB-

ffi

-LRB-

t

-RRB-

due

to

assumption

-LRB-

i

-RRB-

t

t

-LRB-

a

t

S

-RRB-

-LRB-

ffi

-LRB-

a

t

S

-RRB-

-RRB-

-LRB-

ffi

-LRB-

t

-RRB-

-RRB-

-LRB-

t

-RRB-

-LRB-

due

to

the

induction

hypothesis

-RRB-

-RRB-

-LRB-

a

t

S

-RRB-

ba

-LRB-

S

-RRB-

-LRB-

-RRB-

t

b

a

-RRB-

S

-LRB-

-LRB-

a

t

S

-RRB-

-RRB-

-LRB-

-LRB-

t

-RRB-

-RRB-

t

b

a

-LRB-

due

to

assumption

-LRB-

ii

-RRB-

-RRB-

-RRB-

ffi

-LRB-

a

t

S

-RRB-

ffi

-LRB-

S

-LRB-

-LRB-

a

t

S

-RRB-

-RRB-

ffi

-LRB-

a

t

S

-RRB-

-RRB-

ffi

-LRB-

-LRB-

-LRB-

t

-RRB-

-RRB-

ffi

-LRB-

t

-RRB-

-RRB-

ffi

-LRB-

t

-RRB-

t

b

a

-LRB-

due

to

the

induction

hypothesis

-RRB-

As

a

corollary

of

Lemma

we

conclude

that

the

states

of

the

algorithm

after

having

read

exactly

r

segments

from

the

input

strings

S

and

resp

must

be

different

if

the

following

holds

ffl

All

the

addresses

that

are

left

to

be

read

in

both

input

strings

S

and

contain

the

same

segment

each

-LRB-

i

-RRB-

ffl

Additionally

if

all

these

addresses

of

S

and

are

equal

the

further

output

of

the

algorithm

is

different

-LRB-

ii

-RRB-

We

state

this

more

precisely

in

Lemma

Lemma

Let

S

n

be

two

inputs

of

length

n

let

r

r

n

and

let

be

given

an

algorithm

of

class

such

that

-LRB-

i

-RRB-

For

all

k

nr

-LRB-

S

-RRB-

nr

-LRB-

-RRB-

it

holds

that

S

-LRB-

k

-RRB-

-LRB-

k

-RRB-

-LRB-

ii

-RRB-

Additionally

if

nr

-LRB-

S

-RRB-

nr

-LRB-

-RRB-

then

the

set

of

letters

in

the

output

word

-LRB-

r

S

-RRB-

-LRB-

n

S

-RRB-

is

not

equal

to

the

set

of

letters

in

the

output

word

-LRB-

r

-RRB-

-LRB-

n

-RRB-

-LRB-

Remind

that

the

-LRB-

r

S

-RRB-

are

words

over

the

alphabet

itself

rather

than

letters

-RRB-

Then

it

holds

that

ffi

-LRB-

r

S

-RRB-

ffi

-LRB-

r

-RRB-

Proof

Let

ffi

-LRB-

r

S

-RRB-

ffi

-LRB-

r

-RRB-

Using

assumption

-LRB-

i

-RRB-

Lemma

and

Definition

we

conclude

that

nr

-LRB-

S

-RRB-

nr

-LRB-

-RRB-

and

-LRB-

r

t

S

-RRB-

-LRB-

ffi

-LRB-

r

t

S

-RRB-

-RRB-

-LRB-

ffi

-LRB-

r

t

-RRB-

-RRB-

-LRB-

r

t

-RRB-

t

n

r.

However

this

contradicts

assumption

-LRB-

ii

-RRB-

Now

we

are

ready

to

prove

the

first

lower

space

bound

for

algorithms

of

class

Theorem

Every

slot-assignment

algorithm

of

class

requires

-LRB-

n

-RRB-

-LRB-

n

being

the

number

of

segments

-RRB-

internal

space

This

remains

true

even

if

the

set

of

inputs

is

in

Iy

or

Iy

M

-LRB-

with

M

-RRB-

resp

Proof

Obviously

it

is

enough

to

prove

the

assertion

for

the

smallest

class

of

input

sets

Iy

M

-LRB-

with

M

-RRB-

We

define

for

every

n

IN

n

fS

j

jSj

n

and

either

S

-LRB-

i

-RRB-

-LRB-

i

-RRB-

or

S

-LRB-

i

-RRB-

-LRB-

i

-RRB-

for

every

i

ng

This

means

the

following

Consider

the

set

of

segments

shown

in

Figure

which

has

exactly

two

segments

of

length

at

each

y-value

Then

n

is

obtained

from

by

choosing

exactly

one

of

the

two

segments

with

y-value

i

i

n

It

is

easy

to

see

that

n

is

a

subset

of

every

input

set

of

class

Iy

M

-LRB-

with

M

-RRB-

Now

we

assume

that

the

algorithm

has

already

read

exactly

l

n

segments

-LRB-

letters

-RRB-

from

the

input

string

-LRB-

not

necessarily

in

storage-order

-RRB-

n

y

x

Figure

Lemma

shows

with

a

and

b

l

that

we

may

modify

every

input

string

S

without

changing

the

state

ffi

-LRB-

l

S

-RRB-

if

we

let

all

segments

S

-LRB-

k

-RRB-

with

k

-LRB-

S

-RRB-

unchanged

-LRB-

i.e.

if

we

only

change

segments

that

the

algorithm

has

not

read

yet

-RRB-

Thus

for

every

pair

of

input

strings

S

T

n

S

T

we

will

construct

a

modified

pair

Smod

Tmod

n

in

such

a

way

that

Lemma

yields

ffi

-LRB-

l

Smod

-RRB-

ffi

-LRB-

l

Tmod

-RRB-

for

at

least

-LRB-

n

-RRB-

pairs

S

T

n.

-LRB-

Note

that

both

Smod

and

Tmod

may

depend

on

the

pair

-LRB-

S

T

-RRB-

i.e.

Tmod

may

change

if

S

changes

for

example

-RRB-

Since

ffi

-LRB-

l

Smod

-RRB-

ffi

-LRB-

l

S

-RRB-

and

ffi

-LRB-

l

Tmod

-RRB-

ffi

-LRB-

l

T

-RRB-

by

construction

we

conclude

that

ffi

-LRB-

l

S

-RRB-

ffi

-LRB-

l

T

-RRB-

Thus

we

have

found

at

least

-LRB-

n

-RRB-

different

states

ffi

-LRB-

l

S

-RRB-

S

n

which

means

that

the

internal

space

is

at

least

log

-LRB-

n

-RRB-

-LRB-

n

-RRB-

Now

after

having

outlined

the

main

idea

of

the

rest

of

the

proof

we

will

present

it

in

detail

At

first

we

give

the

precise

definition

of

the

modified

pair

Smod

Tmod

n

assigned

to

every

pair

S

T

n

Thereby

we

use

the

fact

that

for

every

fixed

S

the

map

r

-LRB-

r

S

-RRB-

is

a

bijection

-LRB-

see

Definition

-RRB-

So

the

inverse

map

exists

and

we

will

denote

it

by

S

-LRB-

i.e.

the

i-th

segment

of

the

input

string

S

is

the

S

-LRB-

i

-RRB-

th

one

that

the

algorithm

reads

-RRB-

Let

S

T

n

Then

we

define

Smod

-LRB-

i

-RRB-

S

-LRB-

i

-RRB-

if

i

bn

-LRB-

S

-RRB-

-LRB-

-LRB-

i

-RRB-

-LRB-

i

-RRB-

i

-RRB-

if

i

nbn

-LRB-

S

-RRB-

and

S

-LRB-

k

-LRB-

i

-RRB-

-RRB-

-LRB-

-LRB-

i

-RRB-

-LRB-

i

-RRB-

k

-LRB-

i

-RRB-

-RRB-

-LRB-

-LRB-

i

-RRB-

-LRB-

i

-RRB-

i

-RRB-

if

i

nbn

-LRB-

S

-RRB-

and

S

-LRB-

k

-LRB-

i

-RRB-

-RRB-

-LRB-

-LRB-

i

-RRB-

-LRB-

i

-RRB-

k

-LRB-

i

-RRB-

-RRB-

with

the

abbreviation

k

-LRB-

i

-RRB-

-LRB-

S

-LRB-

i

-RRB-

bn

S

-RRB-

i.e.

k

-LRB-

i

-RRB-

is

the

external

address

of

the

segment

that

the

algorithm

has

read

bn

steps

before

the

segment

with

address

i.

Tmod

-LRB-

i

-RRB-

-LRB-

Smod

-LRB-

i

-RRB-

if

i

nbn

-LRB-

S

-RRB-

nbn

-LRB-

T

-RRB-

T

-LRB-

i

-RRB-

otherwise

Notice

that

the

modified

input

strings

are

still

elements

of

the

same

input

set

in

the

class

Iy

Now

let

bn

-LRB-

S

-RRB-

bn

-LRB-

T

-RRB-

and

S

-LRB-

j

-RRB-

T

-LRB-

j

-RRB-

for

some

j

bn

-LRB-

S

-RRB-

Then

since

k

-LRB-

j

-RRB-

nbn

-LRB-

S

-RRB-

nbn

-LRB-

T

-RRB-

we

see

from

the

definition

that

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-LRB-

-LRB-

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

if

S

-LRB-

j

-RRB-

-LRB-

j

-RRB-

-LRB-

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

if

S

-LRB-

j

-RRB-

-LRB-

j

-RRB-

Since

at

the

same

time

we

know

that

Tmod

-LRB-

j

-RRB-

T

-LRB-

j

-RRB-

S

-LRB-

j

-RRB-

we

conclude

that

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-LRB-

-LRB-

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

if

T

-LRB-

j

-RRB-

-LRB-

j

-RRB-

-LRB-

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

if

T

-LRB-

j

-RRB-

-LRB-

j

-RRB-

-LRB-

i.e.

the

endpoints

of

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

and

Tmod

-LRB-

j

-RRB-

have

the

same

x-coordinates

but

have

different

y-coordinates

-RRB-

This

implies

that

j

f

Tmod

-LRB-

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

Tmod

-LRB-

Tmod

-LRB-

j

-RRB-

-RRB-

g

j

On

the

other

hand

the

definition

of

Smod

always

guarantees

that

Smod

-LRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

Smod

-LRB-

Smod

-LRB-

j

-RRB-

-RRB-

That

is

any

correct

slot

assignment

for

Tmod

requires

two

different

slots

while

one

slot

is

sufficient

for

Smod

If

k

-LRB-

j

-RRB-

j

it

is

obvious

that

the

algorithm

can

not

calculate

the

slotassignments

Tmod

-LRB-

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

and

Smod

-LRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

resp

before

reading

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

and

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

resp

from

the

input

Therefore

-LRB-

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

Tmod

-LRB-

Tmod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

-RRB-

and

-LRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

Smod

-LRB-

Smod

-LRB-

k

-LRB-

j

-RRB-

-RRB-

-RRB-

-RRB-

resp

are

letters

of

-LRB-

bn

Tmod

-RRB-

-LRB-

n

Tmod

-RRB-

and

-LRB-

bn

Smod

-RRB-

-LRB-

n

Smod

-RRB-

resp

If

k

-LRB-

j

-RRB-

j

a

similar

consideration

shows

that

-LRB-

Tmod

-LRB-

Tmod

-LRB-

j

-RRB-

-RRB-

j

-RRB-

and

-LRB-

Smod

-LRB-

Smod

-LRB-

j

-RRB-

-RRB-

j

-RRB-

resp

are

letters

of

-LRB-

bn

Tmod

-RRB-

-LRB-

n

Tmod

-RRB-

and

-LRB-

bn

Smod

-RRB-

-LRB-

n

Smod

-RRB-

resp

as

well

Thus

the

two

input

strings

Smod

Tmod

n

together

with

r

bn

fulfill

the

assumptions

of

Lemma

and

we

may

conclude

that

ffi

-LRB-

bn

Smod

-RRB-

ffi

-LRB-

bn

Tmod

-RRB-

Summing

up

what

we

have

proved

so

far

we

get

that

ffi

-LRB-

bn

S

-RRB-

ffi

-LRB-

bn

Smod

-RRB-

ffi

-LRB-

bn

Tmod

-RRB-

ffi

-LRB-

bn

T

-RRB-

if

bn

-LRB-

S

-RRB-

bn

-LRB-

T

-RRB-

or

if

bn

-LRB-

S

-RRB-

bn

-LRB-

T

-RRB-

and

S

-LRB-

j

-RRB-

T

-LRB-

j

-RRB-

for

some

j

bn

-LRB-

S

-RRB-

Proceeding

further

this

means

precisely

that

the

equivalence

classes

of

the

equivalence

relation

on

n

S

T

ffi

-LRB-

bn

S

-RRB-

ffi

-LRB-

bn

T

-RRB-

are

all

subsets

of

the

equivalence

classes

of

the

equivalence

relation

on

n

S

T

bn

-LRB-

S

-RRB-

bn

-LRB-

T

-RRB-

and

S

-LRB-

j

-RRB-

T

-LRB-

j

-RRB-

for

all

j

bn

-LRB-

S

-RRB-

It

is

obvious

from

the

definition

of

n

that

the

cardinality

of

every

equivalence

class

of

the

equivalence

relation

is

at

most

Since

j

nj

there

are

at

least

equivalence

classes

of

the

equivalence

relation

and

therefore

at

least

equivalence

classes

of

the

equivalence

relation

as

well

But

this

means

that

there

are

at

least

different

states

ffi

-LRB-

bn

S

-RRB-

S

n

ae

n

of

the

algorithm

So

the

internal

space

can

not

be

less

than

-LRB-

log

-RRB-

-LRB-

n

-RRB-

Example

To

clarify

the

idea

of

the

proof

we

give

an

example

for

the

case

n

Hence

let

us

assume

that

we

have

two

input

sequences

S

and

T

in

with

the

property

that

they

differ

in

one

of

the

first

segments

being

read

by

a

given

algorithm

which

is

able

to

compute

a

correct

slot

assignment

for

each

input

sequence

of

length

belonging

to

the

class

Iy

Input

sequences

in

this

class

have

start

and

endpoints

in

the

set

fi

j

i

the

segments

are

stored

externally

according

to

decreasing

y-order

and

they

can

consistently

be

numbered

using

at

most

two

different

slots

Figure

and

show

instances

of

S

and

T

where

the

numbers

attached

to

the

segments

reflect

the

access

order

of

the

segments

by

the

given

algorithm

i.

e.

-LRB-

i

-RRB-

is

the

external

address

of

the

i-th

segment

accessed

by

the

algorithm

-LRB-

Note

that

S

and

T

differ

at

the

segment

being

read

into

internal

store

-RRB-

y

external

storage

order

x

Figure

Figure

and

show

the

input

sequences

Smod

and

Tmod

Note

that

Smod

and

Tmod

coincide

with

S

and

T

respectively

for

the

first

segments

being

read

from

external

store

into

core

Smod

and

Tmod

are

identical

for

the

remaining

segments

The

access

order

of

the

last

segments

is

unknown

But

we

know

that

the

given

algorithm

having

read

the

first

segments

of

y

external

storage

order

x

Figure

Smod

and

Tmod

must

have

reached

the

same

state

which

is

reached

after

it

has

read

the

first

segments

of

S

and

T

respectively

y

external

storage

order

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

Smod

x

Figure

Note

that

the

state

of

the

algorithm

may

depend

only

on

the

total

length

of

an

input

sequence

and

on

the

segments

it

has

read

so

far

Smod

and

Tmod

have

been

chosen

such

that

they

require

a

different

slot

assignment

One

slot

suffices

to

store

the

elements

of

Smod

but

Tmod

requires

two

slots

Therefore

the

states

which

the

algorithm

has

reached

after

having

read

the

first

segments

of

Smod

and

Tmod

must

be

different

For

otherwise

it

would

produce

the

same

output

for

any

access

sequence

of

the

last

segments

which

is

incorrect

Left

to

right

scan

of

x-ordered

segments

Now

we

will

prove

the

same

lower

space

bounds

in

the

case

when

the

input

segments

in

the

external

memory

are

stored

according

to

their

x-coordinate

We

may

even

assume

that

every

segment

-LRB-

y

-RRB-

occurs

twice

in

the

input

namely

one

time

it

is

stored

at

the

position

corresponding

to

its

and

the

second

time

at

the

position

given

by

its

Moreover

we

only

consider

algorithms

that

read

the

external

input

storage

exactly

once

from

left

to

right

-LRB-

i.

e.

in

increasing

address

and

x-order

resp

-RRB-

More

precisely

ffi

and

are

as

before

however

-LRB-

r

S

-RRB-

r

Such

algorithms

are

said

to

be

of

class

x

Since

it

is

quite

similar

as

before

the

proof

will

be

given

only

informally

We

consider

the

set

of

segments

x

in

Figure

Let

nx

be

the

set

of

all

inputs

which

are

obtained

from

the

input

x

by

leaving

out

exactly

one

segment

from

each

pair

of

segments

in

parentheses

one

on

top

of

the

other

Figure

shows

an

example

of

such

an

input

in

nx

We

also

assume

that

the

sweep-line

of

our

algorithm

has

already

reached

a

position

which

is

indicated

by

the

dotted

vertical

line

This

means

that

the

algorithm

has

already

read

all

start

and

endpoints

of

the

segments

left

of

the

sweep-line

For

the

segments

crossing

that

line

only

their

left

endpoints

have

been

passed

and

the

segments

to

the

right

of

the

sweep-line

have

not

been

detected

at

all

Lemma

At

this

stage

the

algorithm

can

not

have

output

the

slot

of

any

of

the

segments

except

for

the

six

leftmost

ones

Proof

The

six

leftmost

segments

require

six

different

slots

In

any

slot

assignment

the

number

of

different

slots

must

be

minimal

Therefore

all

other

segments

which

are

not

to

the

right

of

the

sweep-line

have

to

be

labelled

using

the

smallest

five

or

the

greatest

five

of

these

slots

depending

on

whether

segment

oea

or

segment

oeb

occurs

in

the

input

which

is

considered

Since

at

the

considered

stage

of

the

algorithm

oea

or

oeb

respectively

is

unknown

of

the

segments

except

for

the

six

leftmost

ones

can

be

assigned

a

slot

Thus

Lemma

shows

that

the

slots

of

all

the

n

short

segments

which

are

to

the

left

of

the

sweep-line

except

for

the

six

leftmost

ones

must

be

encoded

in

the

internal

state

q

Q

that

the

algorithm

has

reached

Since

these

segments

can

be

arranged

in

different

ways

leading

to

different

slot

assignments

we

know

that

there

must

be

at

least

internal

states

i.

e.

jQj

Thus

we

have

proven

the

following

theorem

Theorem

Every

slot-assignment

algorithm

of

class

x

working

on

input

sets

which

contain

nx

requires

-LRB-

n

-RRB-

internal

space

Conclusion

We

have

seen

that

it

is

impossible

to

beat

the

linear

space

bound

obtained

by

the

optimal

algorithm

presented

in

-LSB-

-RSB-

for

computing

a

minimal

slot

assignment

when

we

assume

that

the

input

is

stored

externally

in

decreasing

y-order

and

each

input

segment

is

read

exactly

once

into

core

Because

a

slot

assignment

for

horizontal

line

segments

will

be

used

as

the

basis

for

the

construction

of

a

skeleton

structure

used

in

scanline

algorithms

with

a

vertical

scanline

the

assumption

that

the

input

segments

are

stored

externally

according

to

decreasing

y-values

is

not

very

realistic

For

a

scanline

algorithm

with

a

vertical

scanline

requires

the

inputs

to

be

stored

in

sorted

x-order

Therefore

it

would

be

more

desirable

to

compute

a

minimal

slot

assignment

for

inputs

of

this

kind

As

we

have

seen

also

in

this

case

linear

space

is

necessary

if

we

assume

that

each

segment

is

read

exactly

once

-LRB-

start

and

endpoints

in

increasing

x-order

-RRB-

into

core

from

external

memory

However

there

is

still

much

room

for

other

attempts

We

may

carry

out

a

fixed

number

of

left

to

right

and/or

right

to

left

scans

we

may

augment

the

segments

with

additional

information

which

may

facilitate

the

computation

of

a

minimal

slot

assignment

we

may

be

satisfied

with

a

small

number

of

slots

instead

of

the

minimal

number

finally

we

may

be

interested

in

the

design

of

a

randomized

algorithm

with

a

good

expected

behavior

instead

of

a

deterministic

one

yielding

the

optimal

result

Hence

the

idea

of

unifying

and

simplifying

a

scanline

algorithm

by

first

computing

a

-LRB-

minimal

-RRB-

slot

assignment

then

constructing

a

semidynamic

skeleton

structure

based

on

the

slot

numbering

and

finally

to

carry

out

the

scanline

algorithm

using

the

semidynamic

structure

may

be

still

feasible

The

results

of

this

paper

only

show

that

the

idea

requires

more

than

a

straightforward

approach

References

-LSB-

-RSB-

R.

Klein

Walking

an

unknown

street

with

bounded

detour

FOCS

-LSB-

-RSB-

M.

S.

Manasse

L.

A.

McGeoch

and

D.

D.

Sleator

Competitive

algorithms

for

online

problems

STOC

-LSB-

-RSB-

M.

S.

Manasse

L.

A.

McGeoch

and

D.

D.

Sleator

Competitive

algorithms

for

server

problems

Journal

of

Algorithms

-LSB-

-RSB-

J.

Nievergelt

and

F.

P.

Preparata

Plane

-LCB-

sweep

algorithms

for

intersecting

geometric

figures

Communications

of

the

ACM

-LSB-

-RSB-

Th

Ottmann

and

D.

Wood

Space-Economical

Plane-Sweep

Algorithms

Computer

Vision

Graphics

and

Image

Processing

-LRB-

-RRB-

-LSB-

-RSB-

D.

D.

Sleator

and

R.

E.

Tarjan

Amortized

efficiency

of

list

update

and

paging

rules

Communications

of

the

ACM

-LRB-

-RRB-

y

external

storage

order

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

-LRB-

-RRB-

Tmod

x

Figure

q

q

q

q

q

q

-LRB-

-LRB-

-LRB-

-LRB-

-LRB-

-LRB-

-RRB-

-RRB-

-RRB-

-RRB-

-RRB-

-RRB-

-RRB-

-RRB-

-LRB-

-LRB-

oea

oeb

Figure

q

qq

q

q

q

oea

Figure

lower bounds
minimal slot assignment
online algorithms
skeleton structures