Content uploaded by Hon Wai Leong

Author content

All content in this area was uploaded by Hon Wai Leong on Sep 24, 2016

Content may be subject to copyright.

New Approximation Algorithms

for Some Dynamic Storage Allocation Problems

Shuai Cheng Li1,HonWaiLeong

1, and Steven K. Quek2

1School of Computing

National University of Singapore

3 Science Drive 2, Singapore 117543

{lisc,leonghw}@comp.nus.edu.sg

2School of Information Technology

Nanyang Polytechnic, Singapore

steven quek@nyp.edu.sg

Abstract. The oﬄine dynamic storage allocation (DSA) problem has

recently received some renewed attention and several new results have

been reported. The problem is NP-complete and the best known re-

sult for the oﬄine DSA is a polynomial time 3-approximation algorithm

[Gerg99]. Better ratios have been reported for special cases if restrictions

are placed on the allowable sizes of the blocks [Gerg96,MuBh99]. In this

paper, we present new techniques for solving special cases with blocks

of restricted sizes and we obtain better approximation ratios for them.

We ﬁrst obtain results for small instances which are then used to solve

the more general cases. Our main results are (i) a 4/3-approximation

algorithm when the maximum block size h=2 (previous best was 3/2);

and (ii) a 1.7-approximation algorithm for the case h=3 (previous best

was 1 11

12 ).

1 Introduction

The dynamic storage allocation (DSA) problem is a classic combinatorial op-

timization problem that has a wide variety of applications, including dynamic

memory allocation in operating systems ([Robs74,Knut73,WJNB95]).

Our study an oﬄine DSA is motivated by the berth allocation problem (BAP)

in busy container transshipment ports (such as Singapore). Ships arriving at the

port have ﬁxed arrival and departure times and have to be berthed with a

(straight-line) section of the port so that they can unload and load containers.

Each vessel must be berth entirely within the section. Eﬀective allocation of

berthing space to the ships is an important planning task in many ports in order

to increase throughput, reduce delay, and optimize the use of scarce resources

(wharf areas, cranes).

We show that the BAP is precisely the oﬄine DSA problem. This DSA prob-

lem was ﬁrst studied by Knuth, Robson and others [Robs74,Knut73] and has

This work was supported in part by the National University of Singapore under

Grant R252-000-128-112.

K.-Y. Chwa and J.I. Munro (Eds.): COCOON 2004, LNCS 3106, pp. 339–348, 2004.

c

Springer-Verlag Berlin Heidelberg 2004

340 Shuai Cheng Li, Hon Wai Leong, and Steven K. Quek

recently received some renewed attention. The problem is NP-complete [GJ79]

and there were a series of approximation algorithms proposed in recent years

[Kier88,Kier91,Gerg96,Gerg99]. The best known result is a 3-approximation al-

gorithm by Gergov [Gerg99]. Better ratios have been reported for special cases

if restrictions are placed on the allowable sizes of the blocks [Gerg96,MuBh99].

In this paper, we present new techniques for solving more special cases (of

blocks with restricted sizes) that produce better approximation ratios. Our mo-

tivation for studying special case are twofold: Firstly, we hope that results of

small special cases will lead to better approximation algorithms for these special

cases. Secondly, our research [Li02] has shown that these approximation algo-

rithms for special cases can be adapted to solve the general case and produce

good results in practice for the berth allocation problem.

2 Problem Formulation and Previous Results

The oﬄine DSA problem is formulated as follows1: An instance Bof the oﬄine

DSA is given by a set of blocks B={B1,B

2,...,B

n}.EachblockBj(1 ≤j≤n)

is a triple of nonnegative integers (sj,a

j,d

j)wheresjis the size of the requested

block while ajand djare the arrival time and departure time of Bj.A(memory)

allocation b(B)=(b1,b

2,...,b

n) is a mapping that assigns to each block Bja

nonnegative integer location bjsuch that for all i, j,(1≤i<j≤n), either

[ai,d

i)∩[aj,d

j)=∅or (bi,b

i+si)∩(bj,b

j+sj)=∅. Note that in the online

version of the DSA, we do not know Bin advance.

The DSA can be geometrically interpreted in 2-D (as illustrated in Figure

1) where the x-axisrepresentsthetimeaxisandthey-axis represents the linear

storage. The block Bjis represented by a rectangle whose x-extend is the time

interval [aj,d

j)andthey-extend is the (contiguous) space allocation denoted

by (bj,b

j+sj). The DSA problem is then to pack the collection of rectangles

given by B={B1,B

2,...,B

n}into a larger rectangle. Since the x-extend of each

block is ﬁxed, the rectangles are only free to move vertically and the allocation

function bmerely determined their ypositions.

Fig. 1. A DSA instance with two blocks.

For any allocation b(B), we deﬁne the cost L(b)=max

(1≤j≤n){bj+sj}.

Geometrically, we can interpret L(b) to be the minimum height of a rectangle

1Our notations are similar to those of [Gerg96].

New Approximation Algorithms 341

that contains all the allocated rectangles. We distinguish two versions of the

DSA. In the optimization version of the DSA, we are given an instance Bof the

DSA and we want to ﬁnd a minimum cost allocation, namely, an allocation bthat

minimizes L(b). In the decision version of the DSA, we are given an instance B

and a cost threshold L0and we want to ﬁnd an allocation b(B)withL(b)≤L0.

The berth allocation problem (BAP) is precisely the decision version of the

oﬄine DSA problem if we model each ship by a block Bj=(sj,a

j,d

j), where the

size sjcorresponds to the length of the ship, while aiand djcorrespond to the

arrival time and departure time of the ship. The cost threshold L0corresponds

to the length of the section. Then the allocation bjcorresponds to the allocation

the ship to the location (bj,b

j+sj) along the section. An allocation b(B)with

L(b)≤L0corresponds to a BAP solution where all the ships are berthed without

overlap within a section of length L0.

We note that the DSA is analogous to a 2-D rectangle packing problem –

that of packing the smaller rectangles into the bigger rectangle. In Figure 2, we

illustrate this viewpoint. We refer to the larger rectangle as the packing area.

Allocating a rectangle can also be viewed as “packing” the rectangle into the

packing area. For the rest of the paper, we shall use the term “allocate” and

“pack” interchangeably.

Fig. 2. The DSA as a 2D packing problem. (a) A solution with width W=5,mt1(B)=

2, mt2(B) = 3, and m(B) = 4. (b) Partitioning the packing area into 5 tracks.

AblockBjis said to be active at time tif t∈[aj,d

j), or equivalently, if

aj≤t<d

j.LetB(t) denote the set of blocks that are active at time t,namely,

B(t)={Bj:t∈[aj,d

j)}. Then, the local density at time t(denoted by mt(B))

is deﬁned to be the total size of the active blocks at time t,namely,mt(B)=

Bj∈B(t)sj.Thedensity of the instance B(denoted by M(B)) is the maximum

local density, namely, M(B)=maxt{mt(B)}. Given an instance Bof the DSA,

it is easy to see that L(b)≥M(B) for any allocation b(B).

The DSA problem is NP complete and there has been a number of approxi-

mation algorithms proposed. This ratio has been steadily reduced from Θ(ln h)

[Robs74], and to 80 by Kierstead [Kier88]. Slusarek [Slus89], and independently,

Kierstead [Kier91] reduced the ratio to 6. Subsequently, this ratio was reduced to

5 by Gergov [Gerg96] and later to 3 [Gerg99]. The latter result is the best-known

general result to date.

342 Shuai Cheng Li, Hon Wai Leong, and Steven K. Quek

Deﬁnition 1. Let DSA(W, M, h)denote the class of DSA instances Bwhere

(1) the maximum block size is h(namely, for all j,1≤sj≤h),

(2) the density of the instance is M(M(B)=M), and

(3) the cost threshold L0=W.

Deﬁnition 2. An instance B∈DSA(W, M, h)is said to be feasible if there

exists an allocation b(B)with L(b)≤W. The class DSA(W, M , h)is said to be

feasible if all instances in the class are feasible.

Then, the optimization version of the DSA problem can be formulated as

follows: Let L(M,h) denote the smallest Wsuch that DSA(W, M, h) is feasible.

For a ﬁxed h,letL(h)=limM→∞ L(M,h)

M. We have the following results:

Theorem 1. [GJ79] L(M, 1) = Mfor all M≥1.Namely,L(1) = 1

Theorem 2. [Gerg99] L(M,h)≤3Mfor all h≥1.Namely,L(h)≤3

Results for several special cases have also been reported. For the DSA vari-

ant with two distinct block sizes (say s1and s2), Gergov [Gerg96] showed that

L(M,{s1,s

2})≤2Mor L({s1,s

2})≤22. For the case of blocks with sizes 1 and

h, it was shown [MuBh99] that the First Fit (FF) algorithm has approximation

ratio 2 −1/h,namely,L({1,h})≤(2 −1/h). Note that this implies L(2) ≤11

2.

For the online DSA problem, we let ODSA(W, M, h) denote the class of

instances in which all the blocks have sizes ≤hand the local density at any

time tis bounded by Mand L0=W.LetN(M, h) denote the smallest Wsuch

that ODSA(W, M, h) is feasible. For a ﬁxed h,letN(h)=limM→∞ N(M,h)

M.For

the general case, the best result, due to Robson [Robs74], is that 0.5Mlog2h≤

N(M,h)≤0.84Mlog2h. For small values of h,ithasbeenshownthatthe

following holds [Knut73,Robs74,LuNO74]:

Theorem 3. For the online DSA, we have

(a) N(2) = 1.5,andmoreprecisely,N(M, 2) = (3M−1)/2,

(b) 12

3≤N(3) ≤111

12 ,

(c) N({1,h})=2−1/h.

In this paper, we study DSA(W, M , h) and obtain values of L(M,h)for

small Mand h= 2 and 3 using new algorithms for solving these basic cases. We

then present new approximation algorithms based on channel partitioning that

achieves improved bounds for L(h), h=2,3. Both of these bounds are superior

to the corresponding best known value for N(h) (the online case). For h=2,it

is known that L(2) ≥5

4while the best known upper bound is 3

2,whichisthe

same as N(2). We improve this to L(2) ≤4

3.Forh= 3, we show that L(3) ≤1.7

while the best known bound for N(3) is 1 11

12 .

2Here, we extend the notation DSA(W, M, h)toDSA(W, M, S), where the Sdenote

the set of allowable block sizes. We also extend the notation of Laccordingly.

New Approximation Algorithms 343

3 Solving Some Small Basic Cases

We ﬁrst solve DSA(W, M, h) classes with some small Mand h=2,3. In solving

these cases, we develop algorithms that partition the packing area into two ad-

jacent channels and use a channel ﬂip procedure for eﬀective allocation. These

ideas are central to the approximation algorithms developed in the next section

for L(2) and L(3).

In our packing algorithm for small DSA instances, it is convenient to divide

the packing area into horizontal tracks of unit length as illustrated in Figure

2(b). For DSA(W,M,h), we have tracks 1,2,...,W, where track krefer to the

horizontal strip whose y-extend is (k−1, k). For a block Bj(with size sj), setting

bj=kis equivalent to allocating the (contiguous) tracks k+1, k+2, ... ,k+sj

to Bj, or equivalently, the y-extend of Bjis (k, k +sj). For example, allocating

a (unit size) block Bjto track 1 means bj=0.

3.1 Basic Cases for h=2

Theorem 4. For the oﬄine DSA problem, we have

(a) L(2,2) = 2,(b)L(3,2) = 3,(c)L(4,2) = 5,(d)L(5,2) = 6.

It is easily shown that DSA(2,2,2) is feasible using a First Fit algorithm. The

algorithm for solving DSA(3,3,2) is a modiﬁed version of online ﬁrst ﬁt which

we call First-Fit with Channel Flip (FF-CF). We ﬁrst divide the 3 tracks into

two channels C1with 1 track and C2with two contiguous tracks. There are two

possible conﬁgurations: (a) C1={1},C2={2,3}or (b) C1={3},C2={1,2}.The

actual conﬁguration in use will vary during the allocation process as described

below.

The algorithm FF-CF processes the blocks in Bin increasing order by their

arrival times. The blocks are packed (allocated) using a modiﬁed ﬁrst ﬁt algo-

rithm trying channel C1ﬁrst, and then C2. With loss of generality, assume that

the conﬁguration used is C1={1},C2={2,3}. In a general step, we want to pack

ablockBthat arrives at time t. We distinguish the following cases:

Case 1: If Bhas size 1, Bis allocated to the ﬁrst free track using ﬁrst ﬁt.

Case 2(a): If Bhas size 2 and channel C2is free, we allocate Bto C2(tracks

2, 3).

If Bhas size 2 and channel C2is not free, then C1must be free and there is

exactly one occupied track in C2(since local density at time t≤3). There are

two sub-cases:

Case 2(b): If the middle track (track 2) of C2is free, then both tracks 1 and

2 are free. We perform a channel-ﬂip operation at time tin which we change

the channel conﬁguration to C2={1,2}and C1={3}. We then allocate block B

to the new C2.

Case 2(c): If the middle track (track 2) of C2is occupied, then the two free

tracks (tracks 1 and 3) are “split” by the middle track. This is illustrated in

Figure 3. In this case, we “exchange” the two tracks in channel C2–namely,

exchange the allocation of all the size 1 blocks in C2that arrives after the most

344 Shuai Cheng Li, Hon Wai Leong, and Steven K. Quek

recent size 2 block. After the exchange operation, tracks 1 and 2 are free at time

tand this case reduces to Case 2(b) above. We perform a channel-ﬂip operation

at time tand allocate Bto the new C2.

Fig. 3. Example of track exchange and Channel Flip operations for DSA(3,3,2). (a)

Channel C1and C2before block B8is assigned; tracks 1 and 3 are free. (b) The

conﬁguration after exchanging the “active size 1 blocks” in C2(blocks B6and B7),

and performing a channel ﬂip. The block B8is assigned to the new C2.

Algorithm 1: DSA-Alg(3,3,2,B): [FF-CF Algorithm]

1. begin

2. Sort the blocks in Bby arrival time;

3. Deﬁne channels C1={1}and C2={2,3};

4. FS ←∅,C2Start ←0

5. for each block Bj∈Bdo

6. if (sj=1)then

7. Pack Bjat the ﬁrst free track using First Fit;

8. if (Bjis packed into C2)then FS ←FS ∪{Bj};

9. else // (sj=2)

10. if (C2is free)

11. then Pack Bjinto C2;

12. else Channel-Flip(FS,Bj);

13. C2Start←dj;FS ←∅;

14. end

15. Procedure Channel-Flip(FS,Bj);

16. begin

17. if (middle track of C2is occupied)

18. then Exchange the track allocation of the blocks in FS on C2;

19. Flip the channel conﬁguration of C1and C2;

20. Pack Bjin the new C2;

21. end {Flip}

The details of the algorithm is shown in Algorithm 1. Correctness of the

algorithm is easily shown by proving the invariant that every size channel-ﬂip

operation generates a new empty C2channel that is used to pack a size 2 block.

The running time for this algorithm is O(nlog n),sinceweneedtosortallthe

blocks, and each block would get allocated once, and ﬂipped at most once.

Proof of Theorem 4(c): To prove Theorem 4(c), namely that L(4,2) = 5,

we ﬁrst prove that DSA(4,4,2) is infeasible. Figure 4 shows an instance of

DSA(4,4,2) that can be shown to be not feasible (using a case analysis).

New Approximation Algorithms 345

Lemma 1. DSA(4,4,2) is not feasible.

Corollary 1. DSA(M, M, h)is infeasible for all h≥2,andM≥4.

Fig. 4. An infeasible DSA(4,4,2) instance. A careful case analysis shows that this

instance requires 5 tracks, namely W= 5. It also gives a lower bound of 5

4for L(2).

Next, we show that DSA(5,4,2) is feasible by giving a constructive algorithm

called First-Fit with Block Partitioning (FF-BP). Instead of partitioning the

tracks, the algorithm partitions the blocks in Binto disjoint subsets B1and

B2which are then separately packed. For DSA(5,4,2), the algorithm FF-BP

partitions Bso that the subset B1has density 2 (m(B1)≤2), and the subset

B2has density 3 (m(B1)≤3). Then the blocks in B1are packed in 2 tracks

using algorithm DSA(2,2,2) and the blocks in B2are packed in 3 tracks using

algorithm DSA(3,3,2).

Algorithm FF-BP goes as follows: blocks in Bare processed in increasing

arrival times. Whenever a blocks Bjarrives, it is appended to B1if mt(B1)+sj≤

2. Otherwise, it is appended to B2. (Details are given in Algorithm 2.)

The correctness of this procedure is shown as follows: First, m(B1)≤2by

construction, and so we only need to show that m(B2)≤3. Blocks of size 1

are trivially placed. Consider a block Bjof size 2 arriving at time t. Then,

at most two tracks are occupied at time t(since total density is 4), namely,

mt(B1)+mt(B2)≤2. If Bjcannot be appended to B1,thenmt(B1)≥1andso

mt(B2)≤1. Thus, mt(B2)≤3aftertheblockBjis appended to B2.

Algorithm 2: DSA-Alg(5,4,2,B): [FF-BP Algorithm]

1. begin

2. Sort the blocks in Bby arrival time;

3. B1←∅;m1=2;

4. B2←∅;m2=3;

5. for each block Bjdo

6. t←ai;

7. if (mt(B1)+sj≤m1)

8. then B1←B

1∪{Bj};

9. else B2←B

2∪{Bj};

10. Apply DSA-Alg(2, 2, 2, B1);

11. Apply DSA-Alg(3, 3, 2, B2);

12. end

The algorithm FF-BP also solves DSA(6, 5, 2) by partitioning the blocks

into two subsets B1and B2having density 3 each. The proof is omitted here.

346 Shuai Cheng Li, Hon Wai Leong, and Steven K. Quek

3.2 Basic Cases for h=3

Theorem 5. For the oﬄine DSA problem, we have

(a) L(3,3) = 3 and (b) L(4,3) = 5.

The proof of Theorem 5(a), namely, than L(3,3) = 3, is simple. We ﬁrst assign

all the blocks of size 3. Then between any two consecutive blocks of size 3, we

have an instance of DSA(3,3,2) that is feasible.

To prove Theorem 5(b), we ﬁrst note that DSA(4,4,3) is infeasible by Corol-

lary 1. Next, we prove that DSA(5,4,3) is feasible. The algorithm used is a gener-

alization of the First Fit with Channel Flip procedure uses in DSA-Alg(3,3,2,B).

We have two channels C2with 2 tracks and C3with 3 tracks. Without loss of

generality, we assume that C2={1,2}and C3={3,4,5}.

Consider a block Bjarriving at time t.Ifsj= 1, it is trivially assigned using

ﬁrst ﬁt. If sj=2,ifC2is free, Bjis assigned to C2otherwise, Bjis assigned to

C3using DSA-Alg(3,3,2) 3.Ifsj=3,andC3is free, Bjis assigned to C3.IfC3

is not free, then C2must be free and there is exactly one occupied track. If track

3 is free, we perform a channel ﬂip at tso that the new C2={4,5}and the new

C3={1,2,3}is free and assign Bjto the new C3. (If track 3 is not free, we ﬁrst

invert the tracks in channel C3so that track 3 is now free.)

4 Approximation Algorithms for Special Cases

In this section, we show how the results for the small instances can be used to

give improved approximation ratios, namely, L(h), for small h.

4.1 Algorithms Based on Multi-level Block Partitioning

We extend the block partitioning ideas used in DSA-Alg(5,4,2) to a multi-level

block partitioning algorithm called FF-MLBP. We illustrate the algorithm with

the case h= 2. The block Bjin Bare considered in increasing arrival time. The

algorithm proceeds in 2 phases as follows:

Phase 1: Let n1=M

3. We deﬁne n1level-1 subsets denoted by B1

1,B1

2, ... ,

B1

n1, each with maximum density m1=3.EachblockBjis assigned using ﬁrst

ﬁt to the ﬁrst subset that can accomodate it. If Bjdoes not ﬁt into any of these

subsets, it is left unassigned (for Phase 2). (Note: We show later that all blocks

of size 1 are assigned in Phase 1 and there are now only blocks of size 2 left.)

Phase 2: Now, deﬁne n2=M

6level-2 subsets denoted by B2

1,B2

2, ... , B2

n2,

each with maximum density m2= 2. It is trivial to assign the remaining blocks

using ﬁrst ﬁt to these subsets.

Theorem 6. DSA(4/3M+4,M,2) is feasible, namely, L(2) ≤4

3.

3Note that this assignment to channel C3may require an “internal” channel ﬂip

within the 3 tracks of C3.

New Approximation Algorithms 347

Proof. We ﬁrst prove the correctness of the algorithm. It is easy to see that all

blocks of size 1 are assigned in Phase 1 since there are n1=M

3subsets each

with maximum density of 3. Hence, there are only blocks of size 2 left in Phase 2.

Suppose that a block Bof size 2 arriving at time tcannot be assigned to any one

of the level-2 subsets (in Phase 2). This implies that at time t,eachofthesen2

subsets must have density 2 (since there are no blocks of height 1). Furthermore,

each of the level-1 subsets must have density at least 2 at time t(since block B

was not assigned in Phase 1). Thus, the total density at time t(excluding block

B)is≥2n1+2n2=2M

3+2M

6≥M. This contradicts the density bound

Mfor all blocks. Thus, all the blocks are successfully assigned in Phase 2.

We now consider the number of tracks needed. Each of the n1level-1 sub-

sets can be solved using DSA(3,3,2) and each of the n2level-2 subsets with

DSA(2,2,2). Thus, the total number of tracks needed is 3n1+2n2≤4

3M+4.

This result improves the previous bound for L(2) from 3/2 (by [MuBh99]) to

4/3. This multi-level block partitioning approach can be generalized for h=3

to give a bound of 11/6 (=1.833) for L(3) using a 3-phase block parititioning

approach with n1=M

3,n2=M

6,n3=M

9,andwithm1=m2=m3=3.

However, a superior result is described in the next section.

4.2 An 1.7-Approximation Algorithm for h=3

In this section, we will present a special multi-level block partitioning algorithm

for h=3 that gives a bound of 1.7 for L(3). We ﬁrst describe a customized block

partitioning algorithm (called FF-BP4) that assigns blocks to a packing area

with 4 tracks. We divide the packing area into two channels C1 and C2 each

with 2 contiguous tracks, say C1={1,2}and C2={3,4}.Ablockofsize1can

be assigned to any free track. A block of size 2 can only be assigned to channel

C1or C2(but not to the tracks 2 and 3 even if they are free). A block of size 3

can be assigned to tracks {1,2,3}or {2,3,4}if there is room (with one of the

channels ﬂipped if necessary). Any block that can not be assigned in this way is

left unassigned.

Let B1be the set of assigned blocks after running algorithm FF-BP4. We

prove that mt(B1)≥2 whenever a block Bcannot be assigned at time t.IfB

is of size 1, then mt(B1)=4.IfBis of size 2, then mt(B1)≥3 except for the

case when tracks {2,3}are free in which case mt(B1)≥2. If Bis of size 3, then

mt(B1)≥2, otherwise we always pack Bsuccessfully.

We are now ready to present the multi-level block partitioning algorithm for

h=3. The algorithm is the same as the 3-phase FF-MLBP except that we use

diﬀerent algorithms to assign blocks to the subsets.

Phase 1: Deﬁne n1=M

4level-1 subsets, with m1= 4 and assign blocks using

algorithm FF-BP4. After this phase, only blocks of sizes 2 and 3 remain.

Phase 2: Deﬁne n2=M

10 level-2 subsets, with m2= 6 and assign blocks using

the algorithm for DSA(6,6,{2,3}) from Theorem 6(d). All blocks of size 2 are

assigned in this phase.

348 Shuai Cheng Li, Hon Wai Leong, and Steven K. Quek

Phase 3: Deﬁne n3=M

30 level-3 subsets, with m3= 3 and assign blocks using

ﬁrst ﬁt.

Theorem 7. DSA(1.7M+13,M,3) is feasible, namely, L(3) ≤1.7.

Proof. We ﬁrst prove the correctness of the algorithm. Suppose that a block B

of size 2, arriving at time tcannot be assigned in Phase 2. This implies that at

time t,eachofthen1level-1 subsets must have density at least 2, and each of

the n2level-2 subsets must have density at least 5. Thus, the total density at

time t(excluding block B)is≥2n1+5n2=2M

4+5M

10 ≥M,whichgives

a contradiction. Thus, all blocks of size 2 are assigned in Phase 2.

Now, suppose that a block Bof size 3, arriving at time tcannot be assigned

in Phase 3. This implies that at time t,eachofthen1level-1 subsets must have

density at least 2, each of the n2level-2 subsets must have density at least 4, and

each of the n3level-3 subsets must have density of 3, Thus, the total density at

time t(excluding block B)is≥2n1+4n2+3n3=2M

4+4M

10 +3M

30 ≥M,

which gives a contradiction. Thus, all blocks of size 3 are also assigned and the

algorithm is correct.

The total number of tracks needed is 4n1+6n2+3n3≤1.7M+ 13.

References

[GJ79] M.R. Garey and D.S. Johnson: Computers and Intractability – A guide to

the Theory of NP-Completeness. Freeman, (1979).

[Gerg96] J. Gergov: Approximation algorithms for dynamic storage allocation. Euro-

pean Symp. on Algorithms (ESA ’96), Springer, LNCS 1136, (1996), 52–61.

[Gerg99] J. Gergov: Algorithms for Compile-Time Memory Optimization. ACM-

SIAM Symposium on Discrete Algorithms, (1999), 907–908.

[Kier88] H. A. Kierstead: The linearity of ﬁrst-ﬁt coloring of interval graphs. SIAM

J. Disc. Math., 1, (1988), 526–530.

[Kier91] H. A. Kierstead: A polynomial time approximation algorithm for Dynamic

Storage Allocation. Discrete Mathematics, 88, (1991), 231–237

[Knut73] D.E. Knuth: Fundamental Algorithms: The art of computer programming.

Volumn 1. Addison-Wesley Pub. (1973).

[Li02] S.C. Li: Algorithms for Berth Allocation Problem, M.Sc Thesis, Depart-

ment of Computer Science, National University of Singapore (2002).

[LuNO74] M.G. Ludy, J. Naor, and A. Orda: Tight Bounds for Dynamic Storage

Allocation. J. ACM, Vol 12, (1974), 491–499.

[MuBh99] P. K. Murthy, S. S. Bhattacharyya: Approximation algorithms and heuris-

tics for dynamic storage allocation problem. UMIACS TR-99-31, University

of Maryland, College Park, (1999).

[Robs74] J. M. Robson: Bounds for some functions concerning dynamic storage al-

location. Journal of the ACM, Vol 21(3), (1974), 491–499.

[Robs77] J. M. Robson: Worst base fragmentation of ﬁrst ﬁt and best ﬁt storage

allocation strategies. Computer Journal, Vol 20, (1977), 242–244.

[Slus89] M. Slusarek: A Coloring Algorithm for Interval Graphs. Proc. 14th Math.

Foundations of Computer Science, LNCS 379, Springer, (1989), 471–480.

[WJNB95] P. R. Wilson, M. S. Johnstone, M. Neely, and D. Boles: Dynamic stor-

age allocation: A survey and critical review. Proceedings of International

Workshop on Memory Management, LNCS 986, (1995).