SlideShare a Scribd company logo
1 of 27
스택과  큐   ( 연결구조에 의한 구현 )
Definition of Stack ,[object Object],[object Object]
Stack ADT Operations ,[object Object],[object Object],[object Object],[object Object],[object Object]
Another Stack Implementation ( 스택의 다른 구현방법 ) ,[object Object],[object Object],[object Object]
Using operator new ,[object Object],[object Object],[object Object]
ItemType  is  char   class StackType Top Pop Push IsFull IsEmpty Private data: topPtr ~StackType ‘ C’  ‘V’ 노드 (node) info next StackType
ItemType  is  float class StackType Top Pop Push IsFull IsEmpty Private data: topPtr ~StackType 23.4  -7.9 StackType
[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]
Tracing Client Code letter ‘ V’ char letter = ‘V’; StackType  myStack; myStack.Push(letter); myStack.Push(‘C’); myStack.Push(‘S’); If (!myStack.IsEmpty() ) { letter = myStack.Top( ); myStack.Pop(); } myStack.Push(‘K’);
Adding newItem to the stack ,[object Object],[object Object],[object Object],[object Object],[object Object],topPtr ‘ X’  ‘C’  ‘L’ ‘ B’ newItem
[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],Implementing Push
[object Object],Using operator delete
Deleting item from the stack ,[object Object],[object Object],[object Object],[object Object],[object Object],topPtr ‘ B’  ‘X’  ‘C’  ‘L’ tempPtr item
Deleting item from the stack ,[object Object],[object Object],[object Object],[object Object],[object Object],topPtr item ‘ X’  ‘C’  ‘L’ tempPtr ‘ B’
[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],Implementing Pop
Implementing IsFull ,[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]
Why is a destructor needed? ,[object Object],[object Object]
Implementing the Destructor  ( 소멸자 구현 ) ,[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]
What is a Queue? ,[object Object],[object Object]
Queue ADT Operations ,[object Object],[object Object],[object Object],[object Object],[object Object]
class QueType<char> QueType ~QueType Enqueue Dequeue . . . Private Data: qFront   qRear  ‘ C’  ‘ Z’  ‘T’
[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]

More Related Content

What's hot

An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1
Ganesh Samarthyam
 
Writing Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel SchulhofWriting Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel Schulhof
WithTheBest
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
Jussi Pohjolainen
 

What's hot (20)

Constructor and destructor
Constructor and destructorConstructor and destructor
Constructor and destructor
 
AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話AnyObject – 自分が見落としていた、基本の話
AnyObject – 自分が見落としていた、基本の話
 
An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1An Overview Of Standard C++Tr1
An Overview Of Standard C++Tr1
 
Writing Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel SchulhofWriting Node.js Bindings - General Principles - Gabriel Schulhof
Writing Node.js Bindings - General Principles - Gabriel Schulhof
 
NS2 Object Construction
NS2 Object ConstructionNS2 Object Construction
NS2 Object Construction
 
Virtual Functions
Virtual FunctionsVirtual Functions
Virtual Functions
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Swift で JavaScript 始めませんか? #iOSDC
Swift で JavaScript 始めませんか? #iOSDCSwift で JavaScript 始めませんか? #iOSDC
Swift で JavaScript 始めませんか? #iOSDC
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
constructors and destructors in c++
constructors and destructors in c++constructors and destructors in c++
constructors and destructors in c++
 
Chap2 class,objects contd
Chap2 class,objects contdChap2 class,objects contd
Chap2 class,objects contd
 
Python 如何執行
Python 如何執行Python 如何執行
Python 如何執行
 
Storage Class Specifiers in C++
Storage Class Specifiers in C++Storage Class Specifiers in C++
Storage Class Specifiers in C++
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
JavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closuresJavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closures
 
Storage classes in c++
Storage classes in c++Storage classes in c++
Storage classes in c++
 
Storage classes in C
Storage classes in C Storage classes in C
Storage classes in C
 
Storage class in c
Storage class in cStorage class in c
Storage class in c
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 

Viewers also liked

UB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The HypeUB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The Hype
cd3c
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрация
kaanow
 

Viewers also liked (20)

C review
C  reviewC  review
C review
 
Crypto sim_cryptolog_cryptospot_v3
Crypto sim_cryptolog_cryptospot_v3Crypto sim_cryptolog_cryptospot_v3
Crypto sim_cryptolog_cryptospot_v3
 
Names of alah
Names of alahNames of alah
Names of alah
 
Windows 8
Windows 8Windows 8
Windows 8
 
My Resume
My ResumeMy Resume
My Resume
 
123 mary
123 mary123 mary
123 mary
 
スクリプトで文字コード変換
スクリプトで文字コード変換スクリプトで文字コード変換
スクリプトで文字コード変換
 
Measurement of NY
Measurement of NYMeasurement of NY
Measurement of NY
 
What is supply chain management program
What is supply chain management programWhat is supply chain management program
What is supply chain management program
 
The role of informal providers in health markets
The role of informal providers in health marketsThe role of informal providers in health markets
The role of informal providers in health markets
 
Yogesh patil visual resume short but sweet 1
Yogesh patil visual resume short but sweet 1Yogesh patil visual resume short but sweet 1
Yogesh patil visual resume short but sweet 1
 
Creating Standout Moments Using Online Video by SeeThat
Creating Standout Moments Using Online Video by SeeThat Creating Standout Moments Using Online Video by SeeThat
Creating Standout Moments Using Online Video by SeeThat
 
Fotosatx
FotosatxFotosatx
Fotosatx
 
UB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The HypeUB21 Presentation: Digital Beyond The Hype
UB21 Presentation: Digital Beyond The Hype
 
SEO, CIM digital bootcamp, April 2013 - Andrew Goode, Blue Dolphin
SEO, CIM digital bootcamp, April 2013 - Andrew Goode, Blue DolphinSEO, CIM digital bootcamp, April 2013 - Andrew Goode, Blue Dolphin
SEO, CIM digital bootcamp, April 2013 - Andrew Goode, Blue Dolphin
 
Zen and the Art of Social Media
Zen and the Art of Social MediaZen and the Art of Social Media
Zen and the Art of Social Media
 
Plant a child
Plant a childPlant a child
Plant a child
 
Turist în orașul meu craiova
Turist în orașul meu  craiovaTurist în orașul meu  craiova
Turist în orașul meu craiova
 
Экспресс регистрация
Экспресс регистрацияЭкспресс регистрация
Экспресс регистрация
 
Article Review : Does Game-Based Learning Work? Results from Three Recent Stu...
Article Review : Does Game-Based Learning Work? Results from Three Recent Stu...Article Review : Does Game-Based Learning Work? Results from Three Recent Stu...
Article Review : Does Game-Based Learning Work? Results from Three Recent Stu...
 

Similar to 강의자료8

Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
shericehewat
 
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
angelsfashion1
 
Can you please debug this Thank you in advance! This program is sup.pdf
Can you please debug this Thank you in advance! This program is sup.pdfCan you please debug this Thank you in advance! This program is sup.pdf
Can you please debug this Thank you in advance! This program is sup.pdf
FashionBoutiquedelhi
 
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docxIn Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
bradburgess22840
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
siennatimbok52331
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
dhavalbl38
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
rashmita_mishra
 
Implement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdfImplement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdf
udit652068
 

Similar to 강의자료8 (20)

stack in java ds - muhammed sdasdasdasdasdas.ppt
stack in java ds - muhammed sdasdasdasdasdas.pptstack in java ds - muhammed sdasdasdasdasdas.ppt
stack in java ds - muhammed sdasdasdasdasdas.ppt
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual
 
Memory Management In C++
Memory Management In C++Memory Management In C++
Memory Management In C++
 
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf #ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
#ifndef LINKED_LIST_ #define LINKED_LIST_ templateclass It.pdf
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
 
Stacks
StacksStacks
Stacks
 
stack in java data structure - muhammed .ppt
stack in java data structure - muhammed .pptstack in java data structure - muhammed .ppt
stack in java data structure - muhammed .ppt
 
Can you please debug this Thank you in advance! This program is sup.pdf
Can you please debug this Thank you in advance! This program is sup.pdfCan you please debug this Thank you in advance! This program is sup.pdf
Can you please debug this Thank you in advance! This program is sup.pdf
 
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docxIn Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
 
Presentation
PresentationPresentation
Presentation
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 
For each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdfFor each task, submit your source java code file.(1) Objective Im.pdf
For each task, submit your source java code file.(1) Objective Im.pdf
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
LinkedQueues.ppt
LinkedQueues.pptLinkedQueues.ppt
LinkedQueues.ppt
 
LinkedQueues.ppt
LinkedQueues.pptLinkedQueues.ppt
LinkedQueues.ppt
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
Implement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdfImplement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdf
 

More from Young Wook Kim

More from Young Wook Kim (8)

강의자료10
강의자료10강의자료10
강의자료10
 
강의자료9
강의자료9강의자료9
강의자료9
 
강의자료7
강의자료7강의자료7
강의자료7
 
강의자료6
강의자료6강의자료6
강의자료6
 
강의자료4
강의자료4강의자료4
강의자료4
 
강의자료3
강의자료3강의자료3
강의자료3
 
강의자료 2
강의자료 2강의자료 2
강의자료 2
 
강의자료5
강의자료5강의자료5
강의자료5
 

강의자료8

  • 1. 스택과 큐 ( 연결구조에 의한 구현 )
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. ItemType is char class StackType Top Pop Push IsFull IsEmpty Private data: topPtr ~StackType ‘ C’ ‘V’ 노드 (node) info next StackType
  • 7. ItemType is float class StackType Top Pop Push IsFull IsEmpty Private data: topPtr ~StackType 23.4 -7.9 StackType
  • 8.
  • 9. Tracing Client Code letter ‘ V’ char letter = ‘V’; StackType myStack; myStack.Push(letter); myStack.Push(‘C’); myStack.Push(‘S’); If (!myStack.IsEmpty() ) { letter = myStack.Top( ); myStack.Pop(); } myStack.Push(‘K’);
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22. class QueType<char> QueType ~QueType Enqueue Dequeue . . . Private Data: qFront qRear ‘ C’ ‘ Z’ ‘T’
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.