SlideShare a Scribd company logo
1 of 42
2.3.5

        twitter.com/jun0683
0




           a               e
        b c d          f       g
                               h

(a:(b,c,d),e:(f,g,:(h)))
RLINK :

DLINK :
A=(b,c,d)                          LIST=(A,a,(A,A))

  b we might expectA=(c,d) ways to representthe same basic within
   As
                 , ,These are many variations on List structures theme
a computer memory.
                     there
                           are usually
according to which binary trees are used to represent general forests of trees:
                 8ay, is used to point to the next element of a List, and another
  LIST            3                                      ->                   b
one field
     ‘
field DLINI may be used to point to the first element of a sub-List. By a natural
extension of the memory representation described in Section 2.3.2, we would
represent the List (5) as follows:


                          b (atom)           c                 e

                                                                    -
                                                                    -
                             g
                                                                              (6)



                                                   -
                                                   -
a       b (atom)   c
                       -
                       -
          9

                           (7)



    -
    -                  -
                       -
Memory          &raight linkage              Circular linkagc               Doublc linkagc

   ……
location

   ……
           INFO     DLINK    RLINK     INFO      DLINK
                                                  L…
                                                   m
                                                           RLINK     INFO
                                                                            h
                                                                            [
                                                                                      o
                                                                                      om
                                                                                             RLINK



                                                                ……                    om
                                        (t
            b                                          m              ’6V   W
                                        b
                                                                                      o
   mw
            c
            e                     A
                                  m
                                        c
                                        t
                                                   O%
                                                   Om           m
                                                                      FU
                                                                            ( mm
                                                                            {
                                                                            h
                                                                                ”     O mm
                                                                                      O
                                                                                               m
                                                                                               m (8)
            -f                          -f                            -f
   m                   m                           I   m                    l m       O%
            g                     A      g         l %                g     l %       om
            -d                    m      -d        Lm  a              -d    h m
                                                                              J       l %      m
                                  A                o%                       {         0%
   m                              A                ka           m           h         1m       m
            -                                     ’m                        h          I
   m        h                     mm               om           mm
                                                                      h
                                                                            ( m        I %
            J                     A                0m
                                                    w           m           { m       l %
                                        3                             J



Here “LLINK" is used for a pointe1' to the left in a doubly linked 1'epresentation.
MIX
         a) 1

                S       T         REF         RLINK
         b)2
                S       T        LLINK RLINK
                            INFO
s(   )  :
t(   )  : t=0                    ,t=1
          t>1
REF     :
L,RLINK :
INFO    :                   .(                        ,
                    ,                   ..)
!




!
(reference counter)
    (                      )

               (       )

(         ?)

    (garbage collection)
1

            2

(   )           0
A

                    NODE(1),NODE(2),...,NODE(M)
      m




A1.
                             (
          )              1

K=1           //K
A2.
K1=K+1           //K1 , K
if(NODE(K) !=        || NODE(K) !=           )
   A3.
else
   if(NODE(ALINK(K)) !=         )//
         NODE(ALINK(K)) =
         if(NODE(ALINK(K)) !=            )
                K1 = min(K1,ALINK(K))
         if(NODE(BLINK(K)) !=        )
                K1 = min(K1,BLINK(K))
A3.
K=K1

if(k<=M)

       A2

else
A
1               m

K               m

K K1            m

    K K1        m

         K K1   m
B



STACK[1],.....



B1.
T
      STACK[1].....,STACK[T]
B2.
/ T
 /    STACK   TOP   ,

if(T=0)

  end
B3.
//stack pop, K

K = STACK[T]

T=T-1
B4.
if(NODE(K) ==    )
   B2
else
   if(NODE(ALINK(K)) !=     )
      NODE(ALINK(K)) =
     T=T+1 //stack push
     STACK[T] = ALINK(K)
  if(NODE(BLINK(K)) !=      )
     NODE(BLINK(K)) =
      T=T+1
      STACK[T] = BLINK(K)
B

                    v                   m

                        v               m

    9           5           v           m

7 7         3 3                 v       m

1   1   1   1   1                   v   m
..

..
C


H
STACK[0],....STACK[H-1]
       X
  T = (T+1)%H
  STACK[T] = X
T=B
  B = (B+1)%H
  K1 = min(K1,STACK[B])
C1.

T = H-1 //TOP

B = H-1 //BOTTOM

K1 = M + 1 //

                   (   % push)
C2.

if(T==B)

  C5
C3

//stack pop

K = STACK[T]

T = (T-1)%H
C4
if(NODE(K) ==      )

   C2

else
   if(NODE(ALINK(K)) !=      )

        NODE(ALINK(K)) =
        ALINK(K)       ( % push)

   if(NODE(BLINK(K)) !=     )

        NODE(BLINK(K)) =

        BLINK(K)       ( % push)

   C2
C5
if( K1 > M ) //                       T=B
                                            B = (B+1)%H

  end                                       K1 = min(K1,STACK[B])


else
  if(NODE(K1) ==     || NODE(K1) !=    )
       K1 = K1 + 1
       C5
  if (NODE(K1) ==    )
       K = K1
       K = K1 + 1
       C4
C
            v                           m
  9     5
                    v                   m
                        v               m
7 7   3 3                   v           m
                                v       m
1 1 1 1 6                           v   m
D

         A,B,C

                 ALINK           BLINK   S,T,REF,RLINK


s(   )  :
t(   )  : t=0             ,t=1
          t>1
REF     :
L,RLINK :
INFO    :            .(                     ,
                 ,               ..)
D1.
//TOP
TOP = NULL
                        P
if(S(P) == 0)
  S(P)=1
  REF(P) = TOP // TOP
  TOP = P
D2.

if(TOP == NULL) //

  end
D3

//TOP          pop

P = TOP

TOP = REF(P)
D4.
P = RLINK(P)
if(P == NULL || T(P) == 0)//
  D2
else
  S(P) = 1
  if(T(P) > 1) //
       S(REF(P)) = 1
  else
       Q = REF(P)
       if(Q != NULL && S(Q) == 0)
             S(Q) = 1
             REF(Q) = TOP
             TOP = Q
             D4
B                                                TOP,Q



                                                                   After      Aftcl'
                                                                   ALINK      BLINK


                                          E4.              E5.
    El.          E2.                     Down              Down              E6. Up
  Tnitinlìzc    Mnrk                     ALINK I Mnrkcd    BLINK I :hrked
                                                 already          alrcady

                       Fig. 38. Flowchart f0 1' AIgorithm E.

E5. [Down BLINK.]     Set Q • BLINK(P). If Q     A and MARK(Q) = 0 , set
    BLINK(P) • T, T • P, P • Q, and go to E2.
E6. [Up.] (This step undoes the link switching made in step E4 or E5; the
    setting of ATOM (T) tells      ALINK(T) or BLINK (T) is to be restored.)
E   (1965   ...-_-)




MARK(1       )

ATOM(                1         )

  0,1

ALINK

BLINK
E1.

T=NULL   //   T   2        NULL   TOP   P


P = P0 //             P0
E2.

MARK(P) = 1 //
E3.

if(ATOM(P) == 1) //   0

  E6
E4.

Q = ALINK(P)

if (Q != NULL && MARK(Q) == 0)

      ATOM(P) = 1

      ALINK(P) = T

      T=P

      p=Q

      E2
E5

Q = BLINK(P)

if(Q != NULL && MARK(Q) == 0)

     BLINK(P) = T

  T=P

     P=Q

     E2
E6
if(T == NULL)
   end
else
  Q=T
  if(ATOM(Q) == 1)   if(ATOM(Q) == 0)
     ATOM(Q) = 0       T = BLINK(Q)
     T = ALINK(Q)
                       BLINK(Q) = P
     ALINK(Q) = P
     P=Q               P=Q
     E5                E6

More Related Content

Viewers also liked

프로그램은 왜 실패 하는가
프로그램은 왜 실패 하는가프로그램은 왜 실패 하는가
프로그램은 왜 실패 하는가홍준 김
 
Holub on Patterns 1장 전
Holub on Patterns 1장 전Holub on Patterns 1장 전
Holub on Patterns 1장 전홍준 김
 

Viewers also liked (6)

프로그램은 왜 실패 하는가
프로그램은 왜 실패 하는가프로그램은 왜 실패 하는가
프로그램은 왜 실패 하는가
 
Taocp 2.1~2.2
Taocp 2.1~2.2Taocp 2.1~2.2
Taocp 2.1~2.2
 
Holub on Patterns 1장 전
Holub on Patterns 1장 전Holub on Patterns 1장 전
Holub on Patterns 1장 전
 
Taocp 2.3
Taocp 2.3Taocp 2.3
Taocp 2.3
 
Taocp
TaocpTaocp
Taocp
 
5장
5장5장
5장
 

More from 홍준 김

1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법
1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법
1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법홍준 김
 
11장 윈도우 스레드 풀 + 12장 파이버
11장 윈도우 스레드 풀 + 12장 파이버11장 윈도우 스레드 풀 + 12장 파이버
11장 윈도우 스레드 풀 + 12장 파이버홍준 김
 
11장 윈도우 스레드 풀
11장 윈도우 스레드 풀11장 윈도우 스레드 풀
11장 윈도우 스레드 풀홍준 김
 
Html5&css 3장
Html5&css 3장Html5&css 3장
Html5&css 3장홍준 김
 
Mongo db문서의생성,갱신,삭제
Mongo db문서의생성,갱신,삭제Mongo db문서의생성,갱신,삭제
Mongo db문서의생성,갱신,삭제홍준 김
 
ManagingHumans/chap25~29
ManagingHumans/chap25~29ManagingHumans/chap25~29
ManagingHumans/chap25~29홍준 김
 
2장 상태구도형 에이전트의 디자인
2장 상태구도형 에이전트의 디자인2장 상태구도형 에이전트의 디자인
2장 상태구도형 에이전트의 디자인홍준 김
 

More from 홍준 김 (7)

1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법
1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법
1.3장 차수 높은 프로시저(higher order procedure)로 요약하는 방법
 
11장 윈도우 스레드 풀 + 12장 파이버
11장 윈도우 스레드 풀 + 12장 파이버11장 윈도우 스레드 풀 + 12장 파이버
11장 윈도우 스레드 풀 + 12장 파이버
 
11장 윈도우 스레드 풀
11장 윈도우 스레드 풀11장 윈도우 스레드 풀
11장 윈도우 스레드 풀
 
Html5&css 3장
Html5&css 3장Html5&css 3장
Html5&css 3장
 
Mongo db문서의생성,갱신,삭제
Mongo db문서의생성,갱신,삭제Mongo db문서의생성,갱신,삭제
Mongo db문서의생성,갱신,삭제
 
ManagingHumans/chap25~29
ManagingHumans/chap25~29ManagingHumans/chap25~29
ManagingHumans/chap25~29
 
2장 상태구도형 에이전트의 디자인
2장 상태구도형 에이전트의 디자인2장 상태구도형 에이전트의 디자인
2장 상태구도형 에이전트의 디자인
 

Recently uploaded

Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 

Recently uploaded (20)

Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 

Taocp 2.3.5

  • 1. 2.3.5 twitter.com/jun0683
  • 2. 0 a e b c d f g h (a:(b,c,d),e:(f,g,:(h)))
  • 4. A=(b,c,d) LIST=(A,a,(A,A)) b we might expectA=(c,d) ways to representthe same basic within As , ,These are many variations on List structures theme a computer memory. there are usually according to which binary trees are used to represent general forests of trees: 8ay, is used to point to the next element of a List, and another LIST 3 -> b one field ‘ field DLINI may be used to point to the first element of a sub-List. By a natural extension of the memory representation described in Section 2.3.2, we would represent the List (5) as follows: b (atom) c e - - g (6) - -
  • 5. a b (atom) c - - 9 (7) - - - -
  • 6.
  • 7. Memory &raight linkage Circular linkagc Doublc linkagc …… location …… INFO DLINK RLINK INFO DLINK L… m RLINK INFO h [ o om RLINK …… om (t b m ’6V W b o mw c e A m c t O% Om m FU ( mm { h ” O mm O m m (8) -f -f -f m m I m l m O% g A g l % g l % om -d m -d Lm a -d h m J l % m A o% { 0% m A ka m h 1m m - ’m h I m h mm om mm h ( m I % J A 0m w m { m l % 3 J Here “LLINK" is used for a pointe1' to the left in a doubly linked 1'epresentation.
  • 8. MIX a) 1 S T REF RLINK b)2 S T LLINK RLINK INFO s( ) : t( ) : t=0 ,t=1 t>1 REF : L,RLINK : INFO : .( , , ..)
  • 9. ! !
  • 10. (reference counter) ( ) ( ) ( ?) (garbage collection)
  • 11. 1 2 ( ) 0
  • 12. A NODE(1),NODE(2),...,NODE(M) m A1. ( ) 1 K=1 //K
  • 13. A2. K1=K+1 //K1 , K if(NODE(K) != || NODE(K) != ) A3. else if(NODE(ALINK(K)) != )// NODE(ALINK(K)) = if(NODE(ALINK(K)) != ) K1 = min(K1,ALINK(K)) if(NODE(BLINK(K)) != ) K1 = min(K1,BLINK(K))
  • 14. A3. K=K1 if(k<=M) A2 else
  • 15. A 1 m K m K K1 m K K1 m K K1 m
  • 16.
  • 17. B STACK[1],..... B1. T STACK[1].....,STACK[T]
  • 18. B2. / T / STACK TOP , if(T=0) end
  • 19. B3. //stack pop, K K = STACK[T] T=T-1
  • 20. B4. if(NODE(K) == ) B2 else if(NODE(ALINK(K)) != ) NODE(ALINK(K)) = T=T+1 //stack push STACK[T] = ALINK(K) if(NODE(BLINK(K)) != ) NODE(BLINK(K)) = T=T+1 STACK[T] = BLINK(K)
  • 21. B v m v m 9 5 v m 7 7 3 3 v m 1 1 1 1 1 v m
  • 22. .. ..
  • 23. C H STACK[0],....STACK[H-1] X T = (T+1)%H STACK[T] = X T=B B = (B+1)%H K1 = min(K1,STACK[B])
  • 24. C1. T = H-1 //TOP B = H-1 //BOTTOM K1 = M + 1 // ( % push)
  • 26. C3 //stack pop K = STACK[T] T = (T-1)%H
  • 27. C4 if(NODE(K) == ) C2 else if(NODE(ALINK(K)) != ) NODE(ALINK(K)) = ALINK(K) ( % push) if(NODE(BLINK(K)) != ) NODE(BLINK(K)) = BLINK(K) ( % push) C2
  • 28. C5 if( K1 > M ) // T=B B = (B+1)%H end K1 = min(K1,STACK[B]) else if(NODE(K1) == || NODE(K1) != ) K1 = K1 + 1 C5 if (NODE(K1) == ) K = K1 K = K1 + 1 C4
  • 29. C v m 9 5 v m v m 7 7 3 3 v m v m 1 1 1 1 6 v m
  • 30. D A,B,C ALINK BLINK S,T,REF,RLINK s( ) : t( ) : t=0 ,t=1 t>1 REF : L,RLINK : INFO : .( , , ..)
  • 31. D1. //TOP TOP = NULL P if(S(P) == 0) S(P)=1 REF(P) = TOP // TOP TOP = P
  • 33. D3 //TOP pop P = TOP TOP = REF(P)
  • 34. D4. P = RLINK(P) if(P == NULL || T(P) == 0)// D2 else S(P) = 1 if(T(P) > 1) // S(REF(P)) = 1 else Q = REF(P) if(Q != NULL && S(Q) == 0) S(Q) = 1 REF(Q) = TOP TOP = Q D4
  • 35. B TOP,Q After Aftcl' ALINK BLINK E4. E5. El. E2. Down Down E6. Up Tnitinlìzc Mnrk ALINK I Mnrkcd BLINK I :hrked already alrcady Fig. 38. Flowchart f0 1' AIgorithm E. E5. [Down BLINK.] Set Q • BLINK(P). If Q A and MARK(Q) = 0 , set BLINK(P) • T, T • P, P • Q, and go to E2. E6. [Up.] (This step undoes the link switching made in step E4 or E5; the setting of ATOM (T) tells ALINK(T) or BLINK (T) is to be restored.)
  • 36. E (1965 ...-_-) MARK(1 ) ATOM( 1 ) 0,1 ALINK BLINK
  • 37. E1. T=NULL // T 2 NULL TOP P P = P0 // P0
  • 40. E4. Q = ALINK(P) if (Q != NULL && MARK(Q) == 0) ATOM(P) = 1 ALINK(P) = T T=P p=Q E2
  • 41. E5 Q = BLINK(P) if(Q != NULL && MARK(Q) == 0) BLINK(P) = T T=P P=Q E2
  • 42. E6 if(T == NULL) end else Q=T if(ATOM(Q) == 1) if(ATOM(Q) == 0) ATOM(Q) = 0 T = BLINK(Q) T = ALINK(Q) BLINK(Q) = P ALINK(Q) = P P=Q P=Q E5 E6

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n