ABSTRACT
Let CHILD = DATA+LENGTH Let ROOT.LEFT - abt2btnt(CHILD, LENGTH, MAXLEVEL, LEVEL+1) Let CHILD = DATA+LENGTH+(LENGTH»LEVEL)/2 Let ROOT.RIGHT - abt2btnt(CHILD, LENGTH, MAXLEVEL, LEVEL+1)
Return ROOT
Chapter 2, Exercise 4. Avoiding recursion, we get:
b is e c t n ( ARRAY, N, U ) : While N > 0
N / - 2 I f U i s odd then ARRAY +« N U / - 2
Return ARRAY
C hapter 4, Exercise 9. Notice that all we have to do is replace “c” with “s” in lp ic O and i l p i c ( ) :
In place local periodization to N points, sine polarity l p i s ( SIG, N, RISE ) :
f i p s ( SIG, SIG, RISE ) f i p s ( SIG+N, SIG+N, RISE ) u ip s ( SIG+N, SIG, RISE )
i l p i s ( SIG, N, RISE ) : f i p s ( SIG+N, SIG, RISE ) u ip s ( SIG, SIG, RISE ) u ip s ( SIG+N, SIG+N, RISE )
Chapter 4, Exercise 10. We must invert the order of operations used by lp ica O :
Inverse local periodizations of adjacent intervals, cosine polarity
i l p i c a f SIG, LENGTHS, NUM, RISE ) : For I = 0 t o NUM-1
f i p c ( SIG+LENGTHS[I], SIG, RISE ) u ip c ( SIG, SIG, RISE ) SIG + - LENGTHS[I]
u ip c ( SIG, SIG, RISE )
To get the sine polarity version i lp is a O , we simply replace each f ip c O with an f ip s O and each u ipcO with a u ipsO .