SlideShare a Scribd company logo
Queue Challenges
Challenge 1: Stack vs. Queue
FILO

First In Last Out

FIFO

First In First Out
Challenge 2: Step-by-step Diagrams
Array
S W I F T
enqueue(“R”)
R
enqueue(“O”)
O
dequeue()enqueue(“C”)
C
dequeue()dequeue()enqueue(“K”)
K
Challenge 2: Step-by-step Diagrams
Ring buffer
I F T
Write
Read
queue3.enqueue("R") false
queue3.enqueue(“O") false
queue3.dequeue() “S”
queue3.enqueue(“C”) true
CS
queue3.dequeue() “W”
queue3.dequeue() “I”
queue3.enqueue(“K”) true
WK
S
Left Stack Dequeue Right Stack Enqueue
enqueue(“R”)
Challenge 2: Step-by-step Diagrams
Double stack
W
F
T
I
R
O
enqueue(“O”)dequeue()enqueue(“C”)
C
dequeue()dequeue()
K
enqueue(“K”)
Challenge 3: Whose turn is it?
Challenge 4: Reverse Queue

More Related Content

What's hot

Rcpp11 genentech
Rcpp11 genentechRcpp11 genentech
Rcpp11 genentech
Romain Francois
 
GeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetGeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheet
Jose Perez
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examplesmua99
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
Sylvain Hallé
 
6. binary tree
6. binary tree6. binary tree
6. binary tree
Geunhyung Kim
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
Sylvain Hallé
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
kenbot
 
ALF 5 - Parser Top-Down
ALF 5 - Parser Top-DownALF 5 - Parser Top-Down
ALF 5 - Parser Top-Down
Alexandru Radovici
 
Preprocessor Programming
Preprocessor ProgrammingPreprocessor Programming
Preprocessor Programming
lactrious
 
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Johan Alexis Arboleda Echeverri
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
Prashant Sharma
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
loyola ICAM college of engineering and technology
 
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
Morris Singer
 
A formalization of complex event stream processing
A formalization of complex event stream processingA formalization of complex event stream processing
A formalization of complex event stream processing
Sylvain Hallé
 

What's hot (15)

Rcpp11 genentech
Rcpp11 genentechRcpp11 genentech
Rcpp11 genentech
 
GeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheetGeoGebra JavaScript CheatSheet
GeoGebra JavaScript CheatSheet
 
8.2
8.28.2
8.2
 
Infix to-postfix examples
Infix to-postfix examplesInfix to-postfix examples
Infix to-postfix examples
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
 
6. binary tree
6. binary tree6. binary tree
6. binary tree
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
 
Data made out of functions
Data made out of functionsData made out of functions
Data made out of functions
 
ALF 5 - Parser Top-Down
ALF 5 - Parser Top-DownALF 5 - Parser Top-Down
ALF 5 - Parser Top-Down
 
Preprocessor Programming
Preprocessor ProgrammingPreprocessor Programming
Preprocessor Programming
 
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
Samples solution-manual-assembly-language-for-x86-processors-7th-edition-by-k...
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
Should I Use CoffeeScript? The Pros and Cons of Working With JavaScript’s Ori...
 
A formalization of complex event stream processing
A formalization of complex event stream processingA formalization of complex event stream processing
A formalization of complex event stream processing
 

More from joonjhokil

iOS 개발자로 계속 성장하는 팁들(슬라이드만)
iOS 개발자로 계속 성장하는 팁들(슬라이드만)iOS 개발자로 계속 성장하는 팁들(슬라이드만)
iOS 개발자로 계속 성장하는 팁들(슬라이드만)
joonjhokil
 
iOS 개발자로 계속 성장하는 팁들
iOS 개발자로 계속 성장하는 팁들iOS 개발자로 계속 성장하는 팁들
iOS 개발자로 계속 성장하는 팁들
joonjhokil
 
Gitflow 깃플로우 공유
Gitflow 깃플로우 공유Gitflow 깃플로우 공유
Gitflow 깃플로우 공유
joonjhokil
 
New uikit in wwdc2021(KOR)
New uikit in wwdc2021(KOR)New uikit in wwdc2021(KOR)
New uikit in wwdc2021(KOR)
joonjhokil
 
php screw를 활용한 php 코드 암호화
php screw를 활용한 php 코드 암호화php screw를 활용한 php 코드 암호화
php screw를 활용한 php 코드 암호화
joonjhokil
 
Swift ui userinput
Swift ui userinputSwift ui userinput
Swift ui userinput
joonjhokil
 
열거형을 활용하는 열가지 방법
열거형을 활용하는 열가지 방법열거형을 활용하는 열가지 방법
열거형을 활용하는 열가지 방법
joonjhokil
 
파이썬 자료형 발표
파이썬 자료형 발표파이썬 자료형 발표
파이썬 자료형 발표
joonjhokil
 
Test expressions
Test expressionsTest expressions
Test expressions
joonjhokil
 
Tdd app setup
Tdd app setupTdd app setup
Tdd app setup
joonjhokil
 
Quick sort in Swift
Quick sort in SwiftQuick sort in Swift
Quick sort in Swift
joonjhokil
 
Binary search
Binary searchBinary search
Binary search
joonjhokil
 
Queue in swift
Queue in swiftQueue in swift
Queue in swift
joonjhokil
 
DDD 3기 누렁이 20191110 회의록
DDD 3기 누렁이 20191110 회의록DDD 3기 누렁이 20191110 회의록
DDD 3기 누렁이 20191110 회의록
joonjhokil
 
Rx MVVM
Rx MVVMRx MVVM
Rx MVVM
joonjhokil
 
Error handling
Error handlingError handling
Error handling
joonjhokil
 
RxSwift Transforming operators
RxSwift Transforming operatorsRxSwift Transforming operators
RxSwift Transforming operators
joonjhokil
 
Observer pattern
Observer patternObserver pattern
Observer pattern
joonjhokil
 
스위프트 ARC 발표 자료
스위프트 ARC 발표 자료스위프트 ARC 발표 자료
스위프트 ARC 발표 자료
joonjhokil
 

More from joonjhokil (19)

iOS 개발자로 계속 성장하는 팁들(슬라이드만)
iOS 개발자로 계속 성장하는 팁들(슬라이드만)iOS 개발자로 계속 성장하는 팁들(슬라이드만)
iOS 개발자로 계속 성장하는 팁들(슬라이드만)
 
iOS 개발자로 계속 성장하는 팁들
iOS 개발자로 계속 성장하는 팁들iOS 개발자로 계속 성장하는 팁들
iOS 개발자로 계속 성장하는 팁들
 
Gitflow 깃플로우 공유
Gitflow 깃플로우 공유Gitflow 깃플로우 공유
Gitflow 깃플로우 공유
 
New uikit in wwdc2021(KOR)
New uikit in wwdc2021(KOR)New uikit in wwdc2021(KOR)
New uikit in wwdc2021(KOR)
 
php screw를 활용한 php 코드 암호화
php screw를 활용한 php 코드 암호화php screw를 활용한 php 코드 암호화
php screw를 활용한 php 코드 암호화
 
Swift ui userinput
Swift ui userinputSwift ui userinput
Swift ui userinput
 
열거형을 활용하는 열가지 방법
열거형을 활용하는 열가지 방법열거형을 활용하는 열가지 방법
열거형을 활용하는 열가지 방법
 
파이썬 자료형 발표
파이썬 자료형 발표파이썬 자료형 발표
파이썬 자료형 발표
 
Test expressions
Test expressionsTest expressions
Test expressions
 
Tdd app setup
Tdd app setupTdd app setup
Tdd app setup
 
Quick sort in Swift
Quick sort in SwiftQuick sort in Swift
Quick sort in Swift
 
Binary search
Binary searchBinary search
Binary search
 
Queue in swift
Queue in swiftQueue in swift
Queue in swift
 
DDD 3기 누렁이 20191110 회의록
DDD 3기 누렁이 20191110 회의록DDD 3기 누렁이 20191110 회의록
DDD 3기 누렁이 20191110 회의록
 
Rx MVVM
Rx MVVMRx MVVM
Rx MVVM
 
Error handling
Error handlingError handling
Error handling
 
RxSwift Transforming operators
RxSwift Transforming operatorsRxSwift Transforming operators
RxSwift Transforming operators
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
스위프트 ARC 발표 자료
스위프트 ARC 발표 자료스위프트 ARC 발표 자료
스위프트 ARC 발표 자료
 

Recently uploaded

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
nikitacareer3
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 

Recently uploaded (20)

Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 

Queue challenges in swift

  • 2. Challenge 1: Stack vs. Queue FILO First In Last Out FIFO First In First Out
  • 3. Challenge 2: Step-by-step Diagrams Array S W I F T enqueue(“R”) R enqueue(“O”) O dequeue()enqueue(“C”) C dequeue()dequeue()enqueue(“K”) K
  • 4. Challenge 2: Step-by-step Diagrams Ring buffer I F T Write Read queue3.enqueue("R") false queue3.enqueue(“O") false queue3.dequeue() “S” queue3.enqueue(“C”) true CS queue3.dequeue() “W” queue3.dequeue() “I” queue3.enqueue(“K”) true WK
  • 5. S Left Stack Dequeue Right Stack Enqueue enqueue(“R”) Challenge 2: Step-by-step Diagrams Double stack W F T I R O enqueue(“O”)dequeue()enqueue(“C”) C dequeue()dequeue() K enqueue(“K”)
  • 6. Challenge 3: Whose turn is it?