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

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Kürzlich hochgeladen (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

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