SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Andere mochten auch

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

Andere mochten auch (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장
 

Mehr von 홍준 김

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장 상태구도형 에이전트의 디자인홍준 김
 

Mehr von 홍준 김 (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장 상태구도형 에이전트의 디자인
 

Kürzlich hochgeladen

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Kürzlich hochgeladen (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

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

Hinweis der Redaktion

  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