SlideShare ist ein Scribd-Unternehmen logo
1 von 20
3 장 ADTs Stack and Queue (Queue)
What is a Queue? ,[object Object],[object Object],[object Object]
Queue ADT Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ADT Queue Operations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],change state observe state
DYNAMIC ARRAY IMPLEMENTATION( circular queue) QueType ~QueType Enqueue Dequeue . . . class QueType Private Data: front   1 rear  4 maxQue  5 items ‘ C’  ‘X’  ‘J’ items [0]  [1]  [2]  [3]  [4] RESERVED
큐 구현  - (1) ,[object Object],[object Object],A B C … B C D … B C … [0] [1] [2] [0] [1] [0] [1] [2] rear rear rear 원소를 하나 삭제한 뒤의 상태 원소를 하나 삽입한 뒤의 상태 -  삭제  : queue[0] 에 있는 앞 원소를 제거    삭제할 때마다 나머지 원소들을 왼쪽으로 이동해야 함    큐가  n 개의 원소를 가질 때 ,  삭제 시  Θ (n)  시간이 걸림 -  삽입  :  배열 크기 조절 시간을 제외하면  Θ (1)  시간이 걸림
큐 구현  - (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],A B C … B C D … B C … rear rear rear 첫번째 원소를 삭제한 뒤의 상태 원소를 하나 삽입한 뒤의 상태 front front front
큐 구현  - (2)  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],… A B C D E A B C D E ... rear rear front front (a)  이동 전 (b)  이동 후
큐 구현  - (3) ,[object Object],[object Object],[object Object],A B C A B C D B C D rear rear rear front front front (a)  현재상태 (b)  삽입 (c)  삭제
Circular Queue items[0] items[1] items[2] items[maxQue-1] 논리적으로 배열의 시작과  끝이 이어져 있는 것으로 간주 items items[0] items[1] items[maxQue-1]
경계조건 (boundary conditions) items[maxQue-1] front rear front rear Enqueue(a1) Enqueue(a2) front rear Enqueue(a3) front rear Dnqueue(x) front rear Queue is empty  인 상태  : rear == front a1 a1 a2 a1 a2 a3 a2 a3
경계조건 (boundary conditions) front rear rear front Enqueue( … )  …  Dequeue( … )  … rear front Enqueue( … )  ⇒  Queue is full Queue 가  empty 일 경우와  full 일 경우 모두  front = rear  가 되어 구분이 가능하지 않다 . 따라서 , Queue 가  full  인 상태 : (rear +1) % maxQue == front a2 a3
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SAYS ALL PUBLIC MEMBERS OF QueType CAN BE  INVOKED FOR OBJECTS OF TYPE CountedQuType ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
class CountedQueType<char>
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Weitere ähnliche Inhalte

Was ist angesagt?

7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍Hyunsoo Jung
 
7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성HyeonSeok Choi
 
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...Seok-joon Yun
 
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기Jong Wook Kim
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Circulus
 
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준Seok-joon Yun
 
알고리즘과 자료구조
알고리즘과 자료구조알고리즘과 자료구조
알고리즘과 자료구조영기 김
 
GDG 2014 - RxJava를 활용한 Functional Reactive Programming
GDG 2014 - RxJava를 활용한 Functional Reactive Programming GDG 2014 - RxJava를 활용한 Functional Reactive Programming
GDG 2014 - RxJava를 활용한 Functional Reactive Programming waynejo
 
7가지 동시성 모델 4장
7가지 동시성 모델 4장7가지 동시성 모델 4장
7가지 동시성 모델 4장HyeonSeok Choi
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)NAVER D2
 
[Swift] Data Structure - Dequeue
[Swift] Data Structure - Dequeue[Swift] Data Structure - Dequeue
[Swift] Data Structure - DequeueBill Kim
 
[Swift] Data Structure - Queue
[Swift] Data Structure - Queue[Swift] Data Structure - Queue
[Swift] Data Structure - QueueBill Kim
 
HolubOnPatterns/chapter3_3
HolubOnPatterns/chapter3_3HolubOnPatterns/chapter3_3
HolubOnPatterns/chapter3_3suitzero
 
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...Seok-joon Yun
 
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)Circulus
 
7. variable scope rule,-storage_class
7. variable scope rule,-storage_class7. variable scope rule,-storage_class
7. variable scope rule,-storage_class웅식 전
 
Realm.io for iOS
Realm.io for iOSRealm.io for iOS
Realm.io for iOSEunjoo Im
 
2.Startup JavaScript - 연산자
2.Startup JavaScript - 연산자2.Startup JavaScript - 연산자
2.Startup JavaScript - 연산자Circulus
 

Was ist angesagt? (20)

7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍7가지 동시성 모델 - 3장. 함수형 프로그래밍
7가지 동시성 모델 - 3장. 함수형 프로그래밍
 
7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성7가지 동시성 모델 - 데이터 병렬성
7가지 동시성 모델 - 데이터 병렬성
 
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
 
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기
NDC14 - Rx와 Functional Reactive Programming으로 고성능 서버 만들기
 
Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체Startup JavaScript 4 - 객체
Startup JavaScript 4 - 객체
 
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
 
알고리즘과 자료구조
알고리즘과 자료구조알고리즘과 자료구조
알고리즘과 자료구조
 
GDG 2014 - RxJava를 활용한 Functional Reactive Programming
GDG 2014 - RxJava를 활용한 Functional Reactive Programming GDG 2014 - RxJava를 활용한 Functional Reactive Programming
GDG 2014 - RxJava를 활용한 Functional Reactive Programming
 
7가지 동시성 모델 4장
7가지 동시성 모델 4장7가지 동시성 모델 4장
7가지 동시성 모델 4장
 
[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)[devil's camp] - 알고리즘 대회와 STL (박인서)
[devil's camp] - 알고리즘 대회와 STL (박인서)
 
[Swift] Data Structure - Dequeue
[Swift] Data Structure - Dequeue[Swift] Data Structure - Dequeue
[Swift] Data Structure - Dequeue
 
[Swift] Data Structure - Queue
[Swift] Data Structure - Queue[Swift] Data Structure - Queue
[Swift] Data Structure - Queue
 
HolubOnPatterns/chapter3_3
HolubOnPatterns/chapter3_3HolubOnPatterns/chapter3_3
HolubOnPatterns/chapter3_3
 
5. queue
5. queue5. queue
5. queue
 
sort algorithim
sort algorithimsort algorithim
sort algorithim
 
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...
[C++ Korea] Effective Modern C++ mva item 7 distinguish between and {} when c...
 
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)
Startup JavaScript 5 - 객체(Date, RegExp, Object, Global)
 
7. variable scope rule,-storage_class
7. variable scope rule,-storage_class7. variable scope rule,-storage_class
7. variable scope rule,-storage_class
 
Realm.io for iOS
Realm.io for iOSRealm.io for iOS
Realm.io for iOS
 
2.Startup JavaScript - 연산자
2.Startup JavaScript - 연산자2.Startup JavaScript - 연산자
2.Startup JavaScript - 연산자
 

Andere mochten auch

Kehittäjävalmennus tornio
Kehittäjävalmennus tornioKehittäjävalmennus tornio
Kehittäjävalmennus tornioMarjo Jussila
 
sss①本郷町内会 通信12月 
sss①本郷町内会 通信12月 sss①本郷町内会 通信12月 
sss①本郷町内会 通信12月 hongochonaikai
 
The future of european video on demand is tv based
The future of european video on demand is tv basedThe future of european video on demand is tv based
The future of european video on demand is tv basedPietro Lambert
 
I hobo lianne howard-dace and tim harford
I hobo   lianne howard-dace and tim harfordI hobo   lianne howard-dace and tim harford
I hobo lianne howard-dace and tim harfordCIM East of England
 
Elements of Investment Success
Elements of Investment SuccessElements of Investment Success
Elements of Investment SuccessWealthbuilder.ie
 
What to Look for in a Marketing Automation System
What to Look for in a Marketing Automation SystemWhat to Look for in a Marketing Automation System
What to Look for in a Marketing Automation SystemBrainSell Technologies
 
"Кликай умно,кликай безопасно!"
"Кликай умно,кликай безопасно!""Кликай умно,кликай безопасно!"
"Кликай умно,кликай безопасно!"Оксана Алексеева
 
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...Alf Tore Meling
 
Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11Syed Asrarali
 
Gioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietGioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietnhutunhien
 
Front legal 1--decreto-supremo-0-20150416_1032
Front legal 1--decreto-supremo-0-20150416_1032Front legal 1--decreto-supremo-0-20150416_1032
Front legal 1--decreto-supremo-0-20150416_1032Naida Labra
 
Konsultasi publik untuk eksekutif dan legislatif daerah
Konsultasi publik untuk eksekutif dan legislatif daerahKonsultasi publik untuk eksekutif dan legislatif daerah
Konsultasi publik untuk eksekutif dan legislatif daerahRia Dj
 
B2B social media marketing warren knight
B2B social media marketing warren knightB2B social media marketing warren knight
B2B social media marketing warren knightCIM East of England
 

Andere mochten auch (20)

Kehittäjävalmennus tornio
Kehittäjävalmennus tornioKehittäjävalmennus tornio
Kehittäjävalmennus tornio
 
簡報2
簡報2簡報2
簡報2
 
España
EspañaEspaña
España
 
Ethics 4
Ethics 4Ethics 4
Ethics 4
 
C way for detailers
C way for detailersC way for detailers
C way for detailers
 
sss①本郷町内会 通信12月 
sss①本郷町内会 通信12月 sss①本郷町内会 通信12月 
sss①本郷町内会 通信12月 
 
The future of european video on demand is tv based
The future of european video on demand is tv basedThe future of european video on demand is tv based
The future of european video on demand is tv based
 
I hobo lianne howard-dace and tim harford
I hobo   lianne howard-dace and tim harfordI hobo   lianne howard-dace and tim harford
I hobo lianne howard-dace and tim harford
 
Django girls-ktm
Django girls-ktmDjango girls-ktm
Django girls-ktm
 
Elements of Investment Success
Elements of Investment SuccessElements of Investment Success
Elements of Investment Success
 
What to Look for in a Marketing Automation System
What to Look for in a Marketing Automation SystemWhat to Look for in a Marketing Automation System
What to Look for in a Marketing Automation System
 
"Кликай умно,кликай безопасно!"
"Кликай умно,кликай безопасно!""Кликай умно,кликай безопасно!"
"Кликай умно,кликай безопасно!"
 
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...
Alf Tore Meling og Jon Wessel-Aas holder foredrag under Webforum 2013. 15. ma...
 
Intro to tsql unit 11
Intro to tsql   unit 11Intro to tsql   unit 11
Intro to tsql unit 11
 
Gioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri vietGioi thieu cong ty nha thep tri viet
Gioi thieu cong ty nha thep tri viet
 
Front legal 1--decreto-supremo-0-20150416_1032
Front legal 1--decreto-supremo-0-20150416_1032Front legal 1--decreto-supremo-0-20150416_1032
Front legal 1--decreto-supremo-0-20150416_1032
 
Konsultasi publik untuk eksekutif dan legislatif daerah
Konsultasi publik untuk eksekutif dan legislatif daerahKonsultasi publik untuk eksekutif dan legislatif daerah
Konsultasi publik untuk eksekutif dan legislatif daerah
 
B2B social media marketing warren knight
B2B social media marketing warren knightB2B social media marketing warren knight
B2B social media marketing warren knight
 
Za našu mamu
Za našu mamuZa našu mamu
Za našu mamu
 
B2B ppc darren bond
B2B ppc darren bondB2B ppc darren bond
B2B ppc darren bond
 

Ähnlich wie 강의자료5

[Swift] Data Structure - Stack
[Swift] Data Structure - Stack[Swift] Data Structure - Stack
[Swift] Data Structure - StackBill Kim
 
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용 [GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용 Sehyeon Nam
 
12장 상속 (고급)
12장 상속 (고급)12장 상속 (고급)
12장 상속 (고급)유석 남
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율S.O.P.T - Shout Our Passion Together
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산S.O.P.T - Shout Our Passion Together
 
사칙연산 프로그램
사칙연산 프로그램사칙연산 프로그램
사칙연산 프로그램중선 곽
 
[Algorithm] Counting Sort
[Algorithm] Counting Sort[Algorithm] Counting Sort
[Algorithm] Counting SortBill Kim
 
2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdfkd19h
 
하스켈 프로그래밍 입문 2
하스켈 프로그래밍 입문 2하스켈 프로그래밍 입문 2
하스켈 프로그래밍 입문 2Kwang Yul Seo
 
05 컬렉션제너릭
05 컬렉션제너릭05 컬렉션제너릭
05 컬렉션제너릭rjawptlsghk
 
Swift3 generic
Swift3 genericSwift3 generic
Swift3 genericEunjoo Im
 
파이썬2.7 기초 공부한 것 정리
파이썬2.7 기초 공부한 것 정리파이썬2.7 기초 공부한 것 정리
파이썬2.7 기초 공부한 것 정리Booseol Shin
 
파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기Yong Joon Moon
 

Ähnlich wie 강의자료5 (20)

강의자료4
강의자료4강의자료4
강의자료4
 
[Swift] Data Structure - Stack
[Swift] Data Structure - Stack[Swift] Data Structure - Stack
[Swift] Data Structure - Stack
 
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용 [GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용
[GPG 스터디] 1.4 게임프로그래밍에서의 STL 활용
 
Swift 0x17 generics
Swift 0x17 genericsSwift 0x17 generics
Swift 0x17 generics
 
4. stack
4. stack4. stack
4. stack
 
12장 상속 (고급)
12장 상속 (고급)12장 상속 (고급)
12장 상속 (고급)
 
STL study (skyLab)
STL study (skyLab)STL study (skyLab)
STL study (skyLab)
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율
[SOPT] 데이터 구조 및 알고리즘 스터디 - #03 : 정렬 (기본, 효율, 초효율
 
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
[SOPT] 데이터 구조 및 알고리즘 스터디 - #02 : 스택, 큐, 수식 연산
 
강의자료3
강의자료3강의자료3
강의자료3
 
Blocking queue
Blocking queueBlocking queue
Blocking queue
 
사칙연산 프로그램
사칙연산 프로그램사칙연산 프로그램
사칙연산 프로그램
 
[Algorithm] Counting Sort
[Algorithm] Counting Sort[Algorithm] Counting Sort
[Algorithm] Counting Sort
 
2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf2012 Ds D2 03 Pdf
2012 Ds D2 03 Pdf
 
하스켈 프로그래밍 입문 2
하스켈 프로그래밍 입문 2하스켈 프로그래밍 입문 2
하스켈 프로그래밍 입문 2
 
Java(4/4)
Java(4/4)Java(4/4)
Java(4/4)
 
05 컬렉션제너릭
05 컬렉션제너릭05 컬렉션제너릭
05 컬렉션제너릭
 
Swift3 generic
Swift3 genericSwift3 generic
Swift3 generic
 
파이썬2.7 기초 공부한 것 정리
파이썬2.7 기초 공부한 것 정리파이썬2.7 기초 공부한 것 정리
파이썬2.7 기초 공부한 것 정리
 
파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기파이썬 Collections 모듈 이해하기
파이썬 Collections 모듈 이해하기
 

Mehr von Young Wook Kim

Mehr von Young Wook Kim (7)

강의자료8
강의자료8강의자료8
강의자료8
 
C review
C  reviewC  review
C review
 
강의자료10
강의자료10강의자료10
강의자료10
 
강의자료9
강의자료9강의자료9
강의자료9
 
강의자료7
강의자료7강의자료7
강의자료7
 
강의자료6
강의자료6강의자료6
강의자료6
 
강의자료 2
강의자료 2강의자료 2
강의자료 2
 

강의자료5

  • 1. 3 장 ADTs Stack and Queue (Queue)
  • 2.
  • 3.
  • 4.
  • 5. DYNAMIC ARRAY IMPLEMENTATION( circular queue) QueType ~QueType Enqueue Dequeue . . . class QueType Private Data: front 1 rear 4 maxQue 5 items ‘ C’ ‘X’ ‘J’ items [0] [1] [2] [3] [4] RESERVED
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Circular Queue items[0] items[1] items[2] items[maxQue-1] 논리적으로 배열의 시작과 끝이 이어져 있는 것으로 간주 items items[0] items[1] items[maxQue-1]
  • 11. 경계조건 (boundary conditions) items[maxQue-1] front rear front rear Enqueue(a1) Enqueue(a2) front rear Enqueue(a3) front rear Dnqueue(x) front rear Queue is empty 인 상태 : rear == front a1 a1 a2 a1 a2 a3 a2 a3
  • 12. 경계조건 (boundary conditions) front rear rear front Enqueue( … ) … Dequeue( … ) … rear front Enqueue( … ) ⇒ Queue is full Queue 가 empty 일 경우와 full 일 경우 모두 front = rear 가 되어 구분이 가능하지 않다 . 따라서 , Queue 가 full 인 상태 : (rear +1) % maxQue == front a2 a3
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 19.
  • 20.