SlideShare a Scribd company logo
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장 전
홍준 김
 
Taocp 2.3
Taocp 2.3Taocp 2.3
Taocp 2.3
홍준 김
 
Taocp
TaocpTaocp
Taocp
홍준 김
 

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

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 

Recently uploaded (20)

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 

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