SlideShare ist ein Scribd-Unternehmen logo
1 von 17
2.2.4 순환목록
circularly linked list 줄여서 circular
list



마지막 노드가 ㅅ가 아니라 처음 노드로 연결.
마지막이 마지막이 아니고 처음이 처음이 아니다.
어디서 시작하든 다 훑을 수 있다.
기본연산

a) 왼쪽 끝에 Y를 삽입: P <= AVAIL, INFO(P) <- Y,LINK(P)<-
LINK(PTR),LINK(PTR)<-p
b) 오른쪽 끝에 Y를 삽입: 왼쪽 끝에 Y를 삽인한 후 PTR<-P로 설
정
c) Y를 왼쪽 끝노드로 설정하고 삭제: P<-LINK(PTR), Y<-
INFO(P),LINK(PTR)<-LINK(P),AVAIL<=P

빈 목록일 떄 처리를 위한 명령어 추가 (빌때 PTR = ㅅ)
(a) INFO(P)<-y다음에 PTR=ㅅ이면 PTR<-LINK(P)<-P 아니면
(c) 처음에 만일 PTR=ㅅ이면 UNDERFLOW 끝에PTR=P이면
PTR<-ㅅ
(a)와(c) 결합은 스택 (b)와(c)결합은 대기열(큐)

전체 삭제가 쉬움
만일 PTR!=ㅅ이면 AVAIL<->LINK(PTR)
[<-> 는 교환 P<-AVAIL,AVAIL<-LINK(PTR),LINK(PTR)<-P]

서로 다른 순환 목록을 합치는 것도 쉬움
                     - 문자열 연결(concatenation)
만일 PTR2 != ㅅ이면
 (만일 PTR1!=ㅅ이면 LINK(PTR1) <->LINK(PTR2);
      PTR1<-PTR2,PTR2<-ㅅ로 설정)
하나를 두개로 나누는 것도 쉬움 - 분리(deconcatenation)
포인터를 하나 더가지면 선형,순환으로 다 사용가능
아니면 그냥 대가리 노드를 두던가.
->



(목록이 비어있을 일이 없음, 끝을 가리키는 포인터가 없으므로
연산(b)포기 )
순환 목록의 이용
- 변수 x,y,z의 정수 계수 다항식 산술
x4+2x3y+3x2y2+4xy3 곱하기 x2-2xy+y2해서
  을 x^6-6xy5+5y6 얻는거
다항식이 얼마나 길어질지 모르므로 linked list사용
노드는 2워드에 이런 모양 ->


       그러니까 x6-6xy5+5y6표현하면
알고리즘 A 다항식 더하기 + 프로그램A

LINK EQU 4:5
ABC EQU 0:3
ADDD STJ 3F
1H ENT3 0,2 ;A1.초기화
  LD2 1,3(LINK) ;Q<-LINK(Q1)
0H LD1 1,1(LINK) ;P<-LINK(P)
SW1 LDA 1,1 ;RA(0:3) <-ABC(P)
2H CMPA 1,2(ABC) ;A2. ABC(P):ABC(Q)
  JE 3F ;같으면 A3
  JG 5F ;크면 A5
  ENT3 0,2 ;작으면 Q1<-Q
  LD2 1,3(LINK) ; Q <-LINK(Q1)
  JMP 2B ;반복
3H JAN * ; A3계수들 더하기
SW2 LDA 0,1 ; COEF(P)
알고리즘 A

Q<-Q+P

A1.초기화
A2.같은 지수 찾아서 A3 (지수가 더크면 새로만들기)
 P보다 Q지수가 작으면 순회, Q지수가 크면 A5
A3.계수더하고 A2 (0이면 A4)
A4.계수가 0인 항 삭제
A5.Q에 새항 삽입
알고리즘M 다항식 곱하기

다항식(Q) + 다항식(M) X 다항식(P)

M1. [다음 승수] M <-LINK(M) 만일 ABC(M)<0이면 알고리즘 끝
M2. 알고리즘 A 약간 변형해서 수행
      ABC(P)대신 ABC(P)+ABC(M)
      COEF(P) 대신 COEF(P)XCOEF(M)
     단계 M1으로 돌아간다.
3. ptr1 = ptr2 연산(3)

그냥 ptr2 <- ㅅ
5.순환목록 뒤집기

Q<-ㅅ, P<-PTR
P!=ㅅ인동안
   R<-Q,Q<-P,P<-LINK(Q),LINK(Q)<-R
     (그러고 나면 Q=PTR)
8. 알고리즘 A에서 Q1이 Q보다 한걸음
뒤에서 따르도록 하는게 유용한 이유
링크 노드 간직할라고.
9.P=Q이면 알고리즘 A가 제대로 작동할까?
네.  그러나 abc>=0이면서 coef=0인 예외적인 케이스 발생하면 오류




그리고 각각 P=M,P=Q,M=Q일 때 알고리즘 M이 제대로 작동할까?
p=m 넵
p=q 넵 M=t1+t2+...t3이면
       p<-px(1+t1)(1+t2)...(1+tk)
m=q넵 q<-q+qxp 단 p의 상수항이 -1일때는 잘못계산
10. 지수가 b-1을 넘지 안흔ㄴ다고 가정.

정신이 몽롱..... 모르겠음.
17. 다항식을 선형목록이 아닌 순환 목
록으로 표현하는 것의 장점
별로 없음. 지우는거 정도?
18. 순환목록 링크필드 하나로 양쪽 방
향으로 순회 가능하게 하려면?
xor로 필드 가지고 있던가 (힌트 참조)
포인터 크기 필드 가감해서 순회 하던가.

Weitere ähnliche Inhalte

Kürzlich hochgeladen

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 

Kürzlich hochgeladen (6)

MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

2.2.4 순환목록

  • 2. circularly linked list 줄여서 circular list 마지막 노드가 ㅅ가 아니라 처음 노드로 연결. 마지막이 마지막이 아니고 처음이 처음이 아니다. 어디서 시작하든 다 훑을 수 있다.
  • 3. 기본연산 a) 왼쪽 끝에 Y를 삽입: P <= AVAIL, INFO(P) <- Y,LINK(P)<- LINK(PTR),LINK(PTR)<-p b) 오른쪽 끝에 Y를 삽입: 왼쪽 끝에 Y를 삽인한 후 PTR<-P로 설 정 c) Y를 왼쪽 끝노드로 설정하고 삭제: P<-LINK(PTR), Y<- INFO(P),LINK(PTR)<-LINK(P),AVAIL<=P 빈 목록일 떄 처리를 위한 명령어 추가 (빌때 PTR = ㅅ) (a) INFO(P)<-y다음에 PTR=ㅅ이면 PTR<-LINK(P)<-P 아니면 (c) 처음에 만일 PTR=ㅅ이면 UNDERFLOW 끝에PTR=P이면 PTR<-ㅅ
  • 4. (a)와(c) 결합은 스택 (b)와(c)결합은 대기열(큐) 전체 삭제가 쉬움 만일 PTR!=ㅅ이면 AVAIL<->LINK(PTR) [<-> 는 교환 P<-AVAIL,AVAIL<-LINK(PTR),LINK(PTR)<-P] 서로 다른 순환 목록을 합치는 것도 쉬움 - 문자열 연결(concatenation) 만일 PTR2 != ㅅ이면 (만일 PTR1!=ㅅ이면 LINK(PTR1) <->LINK(PTR2); PTR1<-PTR2,PTR2<-ㅅ로 설정) 하나를 두개로 나누는 것도 쉬움 - 분리(deconcatenation)
  • 5. 포인터를 하나 더가지면 선형,순환으로 다 사용가능 아니면 그냥 대가리 노드를 두던가. -> (목록이 비어있을 일이 없음, 끝을 가리키는 포인터가 없으므로 연산(b)포기 )
  • 6. 순환 목록의 이용 - 변수 x,y,z의 정수 계수 다항식 산술 x4+2x3y+3x2y2+4xy3 곱하기 x2-2xy+y2해서 을 x^6-6xy5+5y6 얻는거 다항식이 얼마나 길어질지 모르므로 linked list사용 노드는 2워드에 이런 모양 -> 그러니까 x6-6xy5+5y6표현하면
  • 7. 알고리즘 A 다항식 더하기 + 프로그램A LINK EQU 4:5 ABC EQU 0:3 ADDD STJ 3F 1H ENT3 0,2 ;A1.초기화 LD2 1,3(LINK) ;Q<-LINK(Q1) 0H LD1 1,1(LINK) ;P<-LINK(P) SW1 LDA 1,1 ;RA(0:3) <-ABC(P) 2H CMPA 1,2(ABC) ;A2. ABC(P):ABC(Q) JE 3F ;같으면 A3 JG 5F ;크면 A5 ENT3 0,2 ;작으면 Q1<-Q LD2 1,3(LINK) ; Q <-LINK(Q1) JMP 2B ;반복 3H JAN * ; A3계수들 더하기 SW2 LDA 0,1 ; COEF(P)
  • 8. 알고리즘 A Q<-Q+P A1.초기화 A2.같은 지수 찾아서 A3 (지수가 더크면 새로만들기) P보다 Q지수가 작으면 순회, Q지수가 크면 A5 A3.계수더하고 A2 (0이면 A4) A4.계수가 0인 항 삭제 A5.Q에 새항 삽입
  • 9.
  • 10. 알고리즘M 다항식 곱하기 다항식(Q) + 다항식(M) X 다항식(P) M1. [다음 승수] M <-LINK(M) 만일 ABC(M)<0이면 알고리즘 끝 M2. 알고리즘 A 약간 변형해서 수행 ABC(P)대신 ABC(P)+ABC(M) COEF(P) 대신 COEF(P)XCOEF(M) 단계 M1으로 돌아간다.
  • 11. 3. ptr1 = ptr2 연산(3) 그냥 ptr2 <- ㅅ
  • 12. 5.순환목록 뒤집기 Q<-ㅅ, P<-PTR P!=ㅅ인동안 R<-Q,Q<-P,P<-LINK(Q),LINK(Q)<-R (그러고 나면 Q=PTR)
  • 13. 8. 알고리즘 A에서 Q1이 Q보다 한걸음 뒤에서 따르도록 하는게 유용한 이유 링크 노드 간직할라고.
  • 14. 9.P=Q이면 알고리즘 A가 제대로 작동할까? 네. 그러나 abc>=0이면서 coef=0인 예외적인 케이스 발생하면 오류 그리고 각각 P=M,P=Q,M=Q일 때 알고리즘 M이 제대로 작동할까? p=m 넵 p=q 넵 M=t1+t2+...t3이면 p<-px(1+t1)(1+t2)...(1+tk) m=q넵 q<-q+qxp 단 p의 상수항이 -1일때는 잘못계산
  • 15. 10. 지수가 b-1을 넘지 안흔ㄴ다고 가정. 정신이 몽롱..... 모르겠음.
  • 16. 17. 다항식을 선형목록이 아닌 순환 목 록으로 표현하는 것의 장점 별로 없음. 지우는거 정도?
  • 17. 18. 순환목록 링크필드 하나로 양쪽 방 향으로 순회 가능하게 하려면? xor로 필드 가지고 있던가 (힌트 참조) 포인터 크기 필드 가감해서 순회 하던가.