Group Title: Department of Computer and Information Science and Engineering Technical Reports
Title: Folding a stack of equal width components
Full Citation
Permanent Link: http://ufdc.ufl.edu/UF00095281/00001
 Material Information
Title: Folding a stack of equal width components
Alternate Title: Department of Computer and Information Science and Engineering Technical Report ; TR-94-011
Physical Description: Book
Language: English
Creator: Thanvantri, Venkat
Shani, Sartaj
Publisher: Department of Computer and Information Sciences, University of Florida
Place of Publication: Gainesville, Fla.
Copyright Date: 1994
 Record Information
Bibliographic ID: UF00095281
Volume ID: VID00001
Source Institution: University of Florida
Holding Location: University of Florida
Rights Management: All rights reserved by the source institution and holding location.


This item has the following downloads:

1994132 ( PDF )

Table of Contents
        Page 1
        Page 2
        Page 3
        Page 4
        Page 5
        Page 6
        Page 7
        Page 8
        Page 9
        Page 10
        Page 11
        Page 12
        Page 13
        Page 14
        Page 15
        Page 16
        Page 17
        Page 18
Full Text

Folding A Stack Of Equal Width Components *

Venkat Thanvantri and Sartaj Sahni
Department of CIS,
University of Florida,
Gainesville, FL-32611

Technical Report 94-011


We consider two versions of the problem of folding a stack of equal width compo-
nents. In both versions, when a stack is folded, a routing penalty is incurred at the fold.
In one version, the height of the folded layout is given and we are to minimize width.
In the other, the width of the folded layout is given and its height is to be minimized.
For the first version, we develop a fast linear time algorithm. For the second, four
algorithms of complexity O(n log n), O(n log log n), O(n log* n), and O(n) respectively
are presented. Experimental results indicate that in practice, the O(n log n) algorithm
performs best.

Keywords and Phrases
stacked bit slice architectures, folding, layout area

*This research was supported in part by the National Science Foundation under the grant MIP 91-03379

stack 1 stack 2 stack 3 stack 4

i2 Ci2+1

Cil Cil+1


(a) Component Stack

C i3

(b) Folded into four stacks

Figure 1: Stack of components
(adapted from [PAIK93])

1 Introduction

Component stack folding, in the context of bit sliced architectures, was introduced by
Larmore, Gajski, and Wu [LARM90]. In this paper, they used this model to compile
layout for cmos technology. Further applications of the model were considered by Wu
and Gajski [WU90]. In the model of [LARM90] and [WU90] the component stack can be
folded at only one point. In addition, it is possible to reorder the components on the stack.
A related, yet different, folding model was considered by Paik and Sahni [PAIK93]. In
this, no limit is placed on the number of points at which the stack may be folded. Also,
component reordering is forbidden. They point out that this model may also be used in
the application cited by [LARM90] and [WU90]. Furthermore, it accurately models the
placement step of the standard cell and sea-of-gates layout algorithms of Shragowitz et al.




C i1+

r,+1 I ---- Interstack routing

Figure 2: Routing space reserved
(reproduced from [PAIK93])

['ITR A\-- SHRA90].

Formally, a component stack is comprised of variable height and variable width compo-
nents C1, C2, ..., C' stacked one on top of the other. C1 is at the top of the stack and C,
at the bottom (Figure l(a)). If the stack is realized, physically, in this way, the area needed
is Ehi maxz{wi} where hi > 0 is the height of Ci and wi > 0 is its width. If the component
stack is folded at Ci we obtain two adjacent stacks C1, C2,..., Ci and CQ, C 1,..., Ci+1.
The folding also inverts the left to right orientation of the components C0,..., Ci+,. Fig-
ure l(b) shows the stack of Figure l(a) after folding at Cil, Ci, Ci3. Notice that folding
results in a snake-like rearrangement. While not apparent from the figure, each fold flips
the left-to-right orientation of a component. As can be seen from Figure l(b), pairs of
folded stacks may have nested components, components in odd stacks are left aligned; and
components in even stacks are right aligned. The area of the folded stack is the area of the
smallest rectangle that bounds the layout. To determine this, depending on the model, we
may need to add additional space at the stack ends to allow for routing between components
Cik and Ci where Ci, is a folding point. If so, let ri > 0, 2 < i < n, denote the height of
the routing space needed if the stack is folded at Ci_1 (Figure 2).

In practical situations, the height (width) of the rectangle into which the stack is to be

Routing area at stack ends
Stack nesting permitted
No Yes
Equal width, height constrained O(n) O(n2)
Equal width, width constrained O(n) O(n3)
Equal height, height constrained O(n4 log n) O(n4 log n)
Equal height, width constrained O(n4 log2 n) O(n4 log2 n)
Variable heights and widths, height constrained O(n5 log n) O(n5 log n)
Variable heights and widths, width constrained O(n5 log2 n) O(n5 log2 n)

Table 1: Summary of results of [PAIK93]
(reproduced from [PAIK93])

folded may be limited (and known in advance) and we are to minimize the width (height).
Several versions of folding into height (width) constrained rectangles were considered by
Paik and Sahni [PAIK93]. Their results are summarized in Table 1.

In this paper we consider two of the problems considered in [PATIK'.;]

(1) Equal-width, l., '.ill-constrained with routing area at stack ends. For this problem, the
algorithm of [PAIK93] runs in O(n2) time. We develop an O(n) algorithm.

(2) Equal-width, width-constrained with routing area at stack ends. We develop a series
of four algorithms for this problem. These have complexity O(n log n), O(n log log n),
O(nlog* n), and O(n) respectively. Experimental results indicate that the O(nlog n)
algorithm is fastest in practice. This is due to the fact that this algorithm has least

Our algorithms employ two techniques. The first is normalization in which an input
instance is transformed into an equivalent normalized instance that is relatively easy to solve.
The second technique is parameterized searching. In Section 2 we describe our normalization
technique and then in Section 3, we show how this results in a linear time algorithm for the
equal-width height-constrained problem. Parameterized searching is described in Section 4
and then used in Sections 5 to obtain the algorithms for the equal-width width-constrained
problem. Experimental results comparing the relative performance of the various algorithms
for the equal-width width-constrained problem are given in Section 6.

S2 I S

hj-1 hi-1
hj hj+l
rj rj
3 j+1 rj+l

(a) (b)

Figure 3: Case when hj + rj+l < rj

2 Normalization

Let hi be the height of the component Ci, 1 < i < n. Let ri be the routing height needed
between C-_1 and C' if the component stack is folded at Ci1,2 < i < n; and let rl =
r,+l = 0. The defined component stack is normalized iff the conditions C1 and C2 given
below are satisfied for every i, 1 < i < n.

C1 : hi + ri+l > ri

C2 : hi + ri > ri+i

An unnormalized instance I may be transformed into a normalized instance I with
the property that from a minimum height or minimum width folding of I, one can easily
construct a similar folding for I. To obtain I, we identify the least value of i at which either
C1 or C2 is violated. Let this value of i be j. By choice of j, either

hj + rj+l < rj, or
hj + rj < rj+i.

We first note that it is not possible for both of these inequalities to hold simultaneously. To
see this, note that the first yields

rj+l < rj hj

Substituting into the second, we get

hj + rj < rj+l < rj hj

or 2 hj < 0 which is not possible as hj > 0.

Suppose that hj + rj+l < rj. Now j > 1 as hi + r2 > 0 while rl = 0. Also, hj + rj > rj+l.
Consider any folding of I in which Cj-_ is a fold point (Figure 3(a)). Let the height of the
stack Si be h(SI) and that of S2, h(S2). Consider the folding obtained from Figure 3(a) by
moving Cj from S2 to S1. Let the height of the stacks now be h'(SI) and h'(S2). We see

h'(S) = h(S1) r + hj + rj+i < h(S1)


h'(S2) = h(S2) r hj + rj+ < h(S2).

So, the height and width of the folding of Figure 3(b) is no more than that of Figure 3(a).
Hence, the instance I' obtained from I by replacing the component pair ((hj_i, rj_-), (hj, rj))
by the single component (hj-1 + hj, rj_l) has the same minimum width/height folding as
does I. From a minimum width/height folding for I' one can obtain one for I by replacing
the component (hj_1 + hj, rj-1) by the two components of I it is composed of.

If hj + rj < rj+l, then hj + rj+l > rj and j < n ( as r,+l = 0 and hn + r, > 0). If
the component stack is folded at Cj, then we have the situation of Figure 4(a). Figure 4(b)
shows the folding that results when Cj is moved from the bottom of Si to the bottom of
S2. Let h(.) and h'(.) be as before. We have:

h'(S1) = h(S1) hj rj+i + r < h(S1)


h'(S2) = h(S2) r+1 h + r < h(S2).

This time, I' is obtained by replacing the component pair ((hi, rj), (hj+i, rj+i)) by the
single component (hj + hj+l, rj).

S2 ,

-- -h -j+l
hj hj+1 h-
hj_1 hj
Trj+1 rj+ rj rj

(a) (b)

Figure 4: Case when hj + rj < rj+l

The component pair replacement scheme just described may be repeated as often as
needed to obtain a normalized instance I. Note that the scheme terminates as each re-
placement reduces the number of components by one and every one instance component is

The preceding discussion leads to the normalization procedure Normalize of Figure 5.
The input to this procedure is a component stack C[1] ...C[n] and the output is a normalized
stack C[1]... C[n] (the input n (say n") will be generally larger that the output n (say n')).

C[i].h, C[i].r, C[i].f, and C[i].l, respectively, give the height, routing height needed if the
stack is folded at C[i 1], index of first input component represented by C[i], and index of
the last input component represented by C[i]. At input, we have:
C[i].h = h;
C[i].r = ri
C[i].f = C[i].l=
1 < i < n, and C[n + 1].r = 0. Note that, by definition, C[l].r = ri = 0. On output,
component C[i] is the result of combining together the input components f, f + 1,...,1.
The heights and the r values are appropriately set. The correctness of procedure Normalize
is established in Theorem 1. Its complexity is O(n) as each iteration of the while loop takes
constant time; the first two case clauses can be entered atmost a total of n 1 times as
on each entry the number of components is reduced by 1. The else clause can be entered
atmost n 1 times as on each entry next increases by 1 and this variable is never decreased

Procedure Normalize(C,n)
{ Normalize the component stack C[1]...C[n]}
i := 1; next := 2;
while next < n + 1 do
: C[i].h + C[next].r < C[i].r :
{Combine with C[i 1]}
C[i- 1].h :=C[i 1].h + C[i].h;
C[i 1].1:= C[i].l;
i := i 1;
: C[i].h + C[i].r < C[next].r :
{Combine with C[next]}
C[i].h := C[i].h + C[next].h;
C[i].l:= C[next].l;
next := next + 1;
:else: C[i + 1] := C[next];
i := i + 1; next := next + 1;
n:= i 1;
end; {Normalize}

Figure 5: Normalizing a stack

in the procedure.

Theorem 1 : Procedure Normalize produces an equivalent normalized component stack.

Proof : The procedure maintains the following invariant at the start of each iteration of
the while loop:
Invariant: Normalizing conditions C1 and C2 are satisfied by all components C[j],j < 1.

This is clearly true when i = 1 as there is no component C[j] with j < 1. If the invariant
is true at the start of some iteration, then it is true at the end of that iteration. To see
this, note that if we enter the first clause of the case then following the execution of this
clause, C[j].h, C[j].r, C[j + 1].r, j < i', where i' is the value of i following execution of the
clause, are unchanged. So, the execution does not affect C1 and C2 for j < i'. If the second
case-clause is entered, then again C1 and C2 are unaffected by the execution for j < i as
C[j].h, C[j].r, and C[j + 1].r, j < i are unchanged. When the third clause is entered the
validity of C1 and C2 for j < i' follows from the fact that the conditions for the first two
clauses are false.

On termination, next = n + 2. The last iteration of the while loop could not have
entered the first clause of the case statement as in this clause, next is not increased.
While in the second clause, next is increased, the condition C[i].h + C[i].r < C[next].r
cannot be true in the last iteration as now next = n" + 1 (n" is the input value of n),
C[i].h + C[i].r > 0, C[n"].r = 0. So, the last iteration caused execution of the third clause of
the case statement. As a result, C[n"] is moved to position n" + 1 of C. From the invariant,
it follows that C1 and C2 are satisfied for j < i' = n" + 1 (note i' is the final value of i).
Hence the output component stack C[1]...C[n'] is normalized. O

Theorem 2 establishes an important property of a normalized stack. This property
enables one to obtain efficient algorithms for the two folding problems considered in this

Theorem 2 : Let (hi, ri), 1 < i < n define a normalized component stack. Assume that
ro = rn+ = 0. The following are true:
l l
P1 : rk + hj + r+1 < rk-1 + hj + r;+, 1 < k < I < n
j=k j=k-l

l 1+1
P2 : rk + hj +r+ rl+< j=k j=k

Procedure Minimize Width(C, n, h, width)
{ Obtain a minimum width folding whose height is atmost h}
Normalize(C, n);
used := h; width := 1;
for i := 1 to n do
: used C[i].r + C[i].h + C[i + 1].r < h:
{ assign C[i] to current segment }
used := used C[i].r + C[i].h + C[i + 1].r;
:C[i].r + C[i].h + C[i + 1].r > h:
{infeasible instance }
output error message; terminate;
:else:{start next segment, fold at C[i 1] }
width := width + 1;
used := C[i].r + C[i].h + C[i + 1].r
end; {Minimize Width}

Figure 6: Procedure to obtain a minimum width folding

Proof : Direct consequence of C2 and C1, respectively. O

Intuitively, Theorem 2 states that the height needed by a contiguous segment of com-
ponents from a normalized stack increases when the segmented is expanded by adding
components as either end.

3 Equal-Width Height-Constrained

The height of the layout is limited to h and we are to fold the component stack so as
to minimize its width. This can be accomplished in linear time by first normalizing the
stack and then using a greedy strategy to fold only when the next component cannot be
accomodated in the current stack segment without exceeding the height bound h. The
algorithm is given in Figure 6.

From the correctness of procedure Normalize, it follows that a minimum width folding

n [PAIK93] Figure 6
16 0.11 0.05
64 1.80 0.14
256 24.., 0.52

Times are in milliseconds
Table 2: Comparison of equal-width height-constrained algorithms

of the normalized instance is also a minimum width folding of the initial instance. So, we
need only to show that the for loop generates a minimum width folding of the normalized
instance generated by the procedure Normalize. This follows from properties P1 and P2
(Theorem 2) of a normalized instance. Since a segment size cannot decrease by adding more
components at either end, the infeasibility test is correct. Also, there can be no advantage
to postponing the layout of a component to the next segment if it fits in the current one.

Note that while we are able to solve the equal-width height-constrained problem in linear
time using a combination of normalizing and the greedy method, the algorithm of [PAIK93]
uses dynamic programming on the unnormalized instance and takes O(n2) time. In Table
2, we give the observed run times of the two algorithms. These were obtained by running
C programs on a SUN 4 workstation. As is evident, our algorithm is considerably superior
to that of [PAIK93] even on small instances.

4 Parametric Search

In this section, we provide an overview of parametric search. The overview relies heavily on
the developments provided by Frederickson and Johnson [FRED83, FRED84] and Frederick-
son [FRED91, FRED92]. This overview has, however, been tailored to suit our application
here and is not as general as that provided in [FRED83, FRED84, FRED91, FRED92].

Assume that we are given a sorted matrix of O(n2) candidate values i1 ;, 1 < i,j < n.
By sorted, we mean that
S< 1 ;+1,1 < i < n,l and 1 ; < M+,j, 1 < i < n, 1
The matrix is provided implicitly. That is, we are given a way to compute U1 ;, in
constant time, for any value of i and j. We are required to find the least U1 ; that satisfies

some criterion F. The criterion F has the property that if F(x) is not satisfied, then F(y)
is not satisfied (i.e., it is infeasible) for all y < x. Similarly, if F(x) is satisfied (i.e., it is
feasible), then F(y) is feasible for all y > x. In a parametric search, the minimum 1 ;
that satisfies F is found by trying out some of the 1 ;'s. As different 1 ;'s are tried, we
maintain two values A1 and A2, A1 < A2 with the properties:

(a) F(A1) is infeasible.

(b) F(A2) is feasible.

Initially, A1 = 0 and A2 = oo (we assume F is such that F(0) is infeasible, F(oo) is
feasible, and 1 ; > 0 for all candidate values). To determine the next candidate value
to try, we begin with the matrix set S = {M}. At each iteration, the matrices in S are
partitioned into four equal sized matrices (assume, for simplicity, that n is a power of 2). As
a result of this, the size of S becomes four times its previous size. Next, a set T comprised
of the largest and smallest elements from each of the matrices in S is constructed. The
median of T is the candidate value x to try next. The following possibilities exist for x and

(1) x < A1. Since F(A ) is infeasible, F(y) is infeasible for all y < A1. So, F(x) is infeasible.

(2) x > A2. Now, F(x) is feasible.

(3) A1 < x < A2. F(x) may be feasible or infeasible. This is determined by computing
F(x). If x is feasible, A2 is set to x. Otherwise, A1 is set to x.

Following the update (if any) of A1 or A2 resulting from trying out the candidate value
x, all matrices in S that do not contain candidate values y in the range A1 < y < A2 may
be eliminated from S.

A more precise statement of the search process is given by procedure PSEARCH (Fig-
ure 7). This procedure may be invoked as PSEARCH({M},0,oo,x,0). dimension is the
current number of rows or columns in each matrix of S and finish is a stopping rule. The
search for the minimum candidate that satisfies F is terminated when the number of re-
maining candidates is < finish. If A2 = oo when PSEARCH terminates, then none of the
candidate values is feasible. If A2 is finite, then it is the smallest candidate that is feasible.

Since we have assumed n is a power of two, each time a matrix is divided into four, the
submatrices produced are square and have dimension that is also a power of 2. Since M is

Procedure PSEARCH(S,Ai,A il.:, -.:,",, finish);
if dimension > 1 then [ replace each matrix in S by
four equal sized submatrices;
dimension := dimension/2 ]
for i := 1 to 3 do
if dimension = 1 then
[ Let T be the multiset of values in all matrices of S; ]
[ Let T be the multiset obtained by selecting the largest
and smallest values from each matrix of S; ]
x := median(T);
if (A < x < A2) then
if F(x) is feasible then A2 := x
else A1 := x;
Eliminate from S all matrices that have no values
such that A1 < x < A2;
until dimension2 ISI < finish;

Figure 7: Procedure for parametric search. (Adapted from [FRED92].)

provided implicitly, each of its submatrices can be stored implicitly. For this, we need merely
record the matrix coordinates (indices) of the top left and bottom right elements (actually,
the latter can be computed from the former using the submatrix dimension). The multiset
T required on each iteration of the for loop is easy to construct because of the fact that M
is sorted. Note that since M is sorted, all of its submatrices are also sorted. Consequently,
the largest element of each submatix is in bottom right corner and the smallest is in the
top left corner. These elements can therefore be determined in constant time per matrix of

Theorem 3 : [FRED92] The number of feasibility tests F performed by procedure PSEARCH
when started with S = {M}, M an n x n sorted matrix that is provided implicitly is O(log n)
and the total time spent obtaining the candidates for feasibility test is O(n). O

Corollary 1 : Let t(n) be the time needed to determine if F(x) is feasible. The complexity
of PSEARCH is O(n + t(n) log n). O

For some of the algorithms we describe later, PSEARCH will be initiated with ISI > 1
(i.e., S will contain more than one M matrix initially; all matrices in S will still be of
the same size). To analyze the complexity of these algorithms, we shall use the following
theorem and corollary.

Theorem 4 : [FRED92] If PSEARCH is initiated with S containing m sorted matrices,
each of dimension n, then the number of feasibility tests is O(log n) and the total time spent
obtaining the candidate values for these tests is O(mn). O

Corollary 2 : Let t(n) be as in Corollary 1. The complexity of PSEARCH under the
assumptions of Theorem 4 is O(mn + t(n) log n). O

While we have described PSEARCHunder the assumption that the matrices of candidate
values are square and of dimension a power of 2, parametric search easily handles other
matrix shapes and sizes. For this, we can add more rows at the top and columns to the
left so that the matrices become square and have a dimension that is a power of two. The
entries in the new rows and columns are 0. This does not affect the asymptotic complexity
of PSEARCH. Alternatively, we can modify the matrix splitting process to partition into
four roughly equal submatrices at each step. The details of these generalizations are given
in [FRED83, FRED84, FRED91, FRED92].

Procedure PSEARCHis modeled after procedure MSEARCHof [FRED92]. An alterna-
tive search algorithm in which the for loop is iterated twice, once with T being the multiset
of the largest values in S and once with T being the multiset of the smallest values in S
is given in [FRED83, FRED84]. We experimented with both the formulations and found
that for our stack folding application, the three iteration formulation of Figure 7 is faster
by approximately I.;'.

5 Equal-Width Width-Constrained

To use parametric search to determine the minimum height folding when the layout width
is constrained to be < w, we must do the following:

(1) Identify a set of candidate values for the minimum height folding. This set must be
provided implicitly as a sorted matrix with the property that each matrix entry can
be computed in constant time.

(2) Provide a way to determine if a candidate height h is feasible, i.e., can the component
stack be folded into a rectangle of height h and width w ?

In this section, for (1), we shall provide an n x n sorted matrix M (n is the number
of components in the stack) of candidate values. For the feasibility test of (2), we can use
procedure Minimize Width of Figure 6 by setting h equal to the candidate height value being
tested and then determining if width < w following execution of the procedure. Since the
component stack needs to be normalized only once and since Minimize Width will be invoked
for O(log n) candidate values, the call to Normalize should be removed from the procedure
Minimize Width and normalization done before the first invocation of this procedure. Also,
the remaining code may be modified to terminate as soon as w folds are made.

Since feasibility testing and normalization each take linear time, from Corollary 1, it
follows that the complexity of the described parametric search to find the minimum height
folding is O(n + t(n)log n) = O(n + n log n) = O(nlog n).

To determine the candidate matrix M, we observe that the height of any layout is given

ri + hq + rj+l

for some i,j, 1 < i < j < n. This formula just gives us the height of the segment that
contains components Ci through Cj. Define Q to be the n x n matrix with the elements

Sri + E=i h, + rj+,1 Qj 0, i > j

Then for every value of w, Q contains a value that is the height of a minimum height folding
of the component stack such that the folding has width < w. From Theorem 2, it follows

Qij < Q,j+, 1 < i < n, 1
Qj > Q+1,j, i < n,
Let ; = Q,-i+_,j, 1 < i < j < n. So, M is a sorted matrix that contains all candidate
values. The minimum 1 ; for which a width w folding is possible is the minimum height
width-w folding. We now need to show how the elements of M may be computed efficiently
given the index pair (i,j). Let

Hi= hj,l < i < n

and let Ho = 0. We see that

ri + Hj Hi-1 +rj+,i< j
S=0,i >j

and so,

-rni+i + Hj Hi + rj+l, i + j > n + 1
So, if we precompute the Hits each ; can be determined in constant time. The
precomputation of the Hi's takes O(n) time. Hence, the overall complexity of the parametric
search algorithm to find the minimum height folding remains O(n log n).

We note that our O(nlogn) algorithm is very similar to the O(nlogn) algorithm of
[FRED83] to partition a path into k subpaths such that the length of the shortest subpath
is maximized. The differences are that

(1) We need to normalize the component stack before parametric search can be used. and,

n [PAIK93] O(nlogn) O(nloglogn) O(nlog*n) O(n)
16 4.9 1.47 2.28 1.49 1.52
64 314.7 8.84 15.75 27.14 26.71
256 23255 45.96 76.55 169.58 169.42
4096 1041.90 2148.60 2597.75 2760.25

Times are in milliseconds
Table 3: Run times of equal-width width-constrained algorithms

(2) The definition of 11 ; needs to be ..1,1-Ii. .1 to account for the routing heights ri and
rj+l needed at either end of the stack.

[FRED83, FRED84, FRED91, FRED92] present several refinements of the basic para-
metric search technique. These refinements apply to the equal-width width-constrained
problem just as well as to the path partitioning problem provided we start with a normal-
ized instance and use the candidate matrix M defined above. To apply these refinements
we do not need much development specific to the component stack problem. As a re-
sult we do not describe the refined algorithms here. The interested reader is referred to
[FRED83, FRED84, FRED91, FRED92]. The refinements result in algorithms of complex-
ity O(nloglogn), O(nlog* n), and O(n) for our component stack problem.

6 Experimental Results

The four parametric search algorithms for the equal-width height-constrained problem were
programmed in C and run on a SUN 4 workstation. For comparison purposes, the O(n3)
dynamic programming algorithm of [PAIK93] was also programmed. The run time perfor-
mance of these five algorithms is given in Table 3. These times represent the average time for
ten instances of each size. The algorithm of [PAIK93] takes much more time than each of the
parametric search algorithms. However, within the class of parametric search algorithms,
the O(nlog n) one is fastest in the tested problem size range. This may be attributed to the
increased overhead associated with the remaining algorithms. The O(nlog n) algorithm is
recommended for use in practice unless the number of components in a stack is very much
larger than 4096.

7 Conclusions

We have shown that while the equal-width height-constrained and equal-width width-
constrained stack folding problems cannot be solved by applying the greedy method and
parametric search, respectively, these methods can be successfully applied if the input is
first normalized. Normalization can be done in linear time. Hence the overall complexity is
determined by that of applying the greedy method or parametric search to the normalized

We have developed a linear time algorithm for the equal-width height-constrained prob-
lem. This compares very favorably (both analytically and experimentally) with the O(n2)
dynamic programming algorithm of [PAIK93].

For the equal-width width-constrained problem we have developed four algorithms of
complexity O(n log n), O(n loglog n), O(n log* n), and O(n), respectively. All compare very
favorably with the O(n3) dynamic programming algorithm of [PAIK93]. Experimental
results indicate that the O(nlog n) algorithm performs best on practical size instances.


[FRED83] G. N. Frederickson, and D. B. Johnson, "Finding kth paths and p-centers by
generating and searching good data structures", Journal of Algorithms, 4:61-80, 1','.;

[FRED84] G. N. Frederickson, and D. B. Johnson, "Generalized selection and ranking:
sorted matrices", SIAM Journal on computing, 13:14-30, 1', L.

[FRED91] G. N. Frederickson, "Optimal algorithms for tree partitioning", Proc. .',.1 AC II-
SIAM Symposium on Discrete Algorithms, San Francisco, California (Jan. 1991), pp.

[FRED92] G. N. Frederickson, "Optimal parametric search algorithms in trees I: tree par-
titioning", manuscript, Purdue University, Nov. 1992.

[HOR078] E. Horowitz, and S. Sahni, "Fundamentals of Computer Algorithms", Computer
Science Press, Maryland, 1978.

[LARM90] L. Larmore, D. Gajski and A. Wu, "Layout Placement for ', ...[ Architecture",
University of California, Irvine, Technical Report, 1990.

[PAIK93] D. Paik, S. Sahni, "Optimal folding of bit sliced -1.11-", IEEE Trans. on CAD
of Intqralted Circuits and Systems, 12, 11, Nov. 1993, 1679-11'''

['-TTRA\"] E. Shragowitz, L. Lin, S. Sahni, modelss and algorithms for structured layout",
Computer Aided D.-sign, Butterworth & Co, 20, 5, 1'i 263-271.

[SHRA90] E. Shragowitz, J. Lee, and S. Sahni, "Placer-router for sea-of-gates design style",
in P,., -- in computer aided VLSI I. -'-,/ Ed. G.Zobrist, Ablex Publishing, Vol 2,
1990, 43-92.

[WU90] A. Wu, and D. Gajski, "Partitioning Algorithms for Layout Synthesis from
Register-Transfer N. i1-i -", Proc. of International Conference on Computer Aided De-
.. November 1990, pp. 144-147.

University of Florida Home Page
© 2004 - 2010 University of Florida George A. Smathers Libraries.
All rights reserved.

Acceptable Use, Copyright, and Disclaimer Statement
Last updated October 10, 2010 - - mvs