SlideShare a Scribd company logo
Lists, Queues,
Stacks
CST200 – Week 5: Array based Implementation

Instructor: Andreea Molnar
Outline
• Lists
• Queues
• Stacks
List
A sequence of items that has at least the
functionality below:

• Accessing an item at a given position
• Adding an item at a given position
• Removing an item
• Determining the number of items
Stack
A sequence of items in which:

•
•

An item can be inserted only to the top
Only the top item can be
accessed/removed

In a stack items are inserted and removed
according to the last-in first-out (LIFO)
principle.
Stack
Functionality:

•
•
•
•
•

push: insert an item to the top of the stack
pop: remove the item at the top of the stack

peek: get the item at the top of the stack
isEmpty: assess if the stack is empty

isFull: assess if the stack is full
Stack
Assuming that one has an object myStack:

myStack.push (25)

25

mySta
ck
Stack
Assuming that one has an object myStack:

myStack.push (25)
myStack.push (10)

10

25

mySta
ck
Stack
Assuming that one has an object myStack:

myStack.push (25)

myStack.push (10)

10
25

mySta
ck

int topValue = myStack.pop ()

10

topVa
lue
Stack
Assuming that one has an object myStack:
myStack.push (25)
myStack.push (10)

int topValue = myStack.pop ()

5
25

mySta
ck

myStack.push (5)

10

topVa
lue
Stack
Assuming that one has an object myStack
myStack.push (25)
myStack.push (10)

5
25

mySta
ck

int topValue = myStack.pop ()
myStack.push (5)

10

topVa
lue
Stack
Assuming that one has an object myStack:
myStack.push (25)
myStack.push (10)
int topValue = myStack.pop ()
myStack.push (5)
myStack.push (20)

20
5
25
10

mySta
ck

topVa
lue
Stack
Assuming that one has an object myStack:
myStack.push (25)

myStack.push (10)
int topValue = myStack.pop ()

myStack.push (5)
myStack.push (20)
topValue = myStack.pop ()

20
5
25
20

mySta
ck

topVa
lue
Queue
A sequence of items in which the first
element inserted is the first one to be
removed.
In a queue elements are inserted and
removed based on the the first-in first-out
(FIFO) principle.
Queue
Functionality:

•
•
•

enqueue: add an item to the back of the queue

dequeue: remove the front item
getFront: get the front item
Queue
Assuming that one has an object myQueue:

myQueue.enque (25)

25

myQue
ue
Queue
Assuming that one has an object myQueue:

myQueue.enque (25)
int value = myQueue.deque ()

25

25

myQue
ue
value
Queue
Assuming that one has an object myQueue:

myQueue.enque (25)
int value = myQueue.deque ()

20

myQueue.enque (20)

25

myQue
ue
value
Queue
Assuming that one has an object myQueue:

myQueue.enque (25)
int value = myQueue.deque ()

myQueue.enque (20)

20

5

myQue
ue

myQueue.enque (5)

25

value
Queue
Assuming that one has an object myQueue:
myQueue.enque (25)
int value = myQueue.deque ()
myQueue.enque (20)

20

5

myQueue.enque (5)
value = myQueue.deque ()

20

myQue
ue
value
Summary
•
•
•

A list is sequence of items that allows to access, add
and remove an arbitrary element and determine the
numbers of items (length/size of the list).
A stack is a data structure in which an item can be
added, accessed or removed only from the top.
A queue is a data structure in which the first element
added is the first one to be accessed/removed.
Ad

More Related Content

Similar to Lists, queues and stacks (20)

Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
ssuserff72e4
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
ssuserff72e4
 
Queues operation using data structure in c
Queues operation using data structure in cQueues operation using data structure in c
Queues operation using data structure in c
BalaKrishnan466
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
MeghadriGhosh4
 
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.pptQueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
GanaviBY
 
Queues in C++ detailed explanation and examples .ppt
Queues in C++ detailed explanation and examples .pptQueues in C++ detailed explanation and examples .ppt
Queues in C++ detailed explanation and examples .ppt
Jamiluddin39
 
stack coding.pptx
stack coding.pptxstack coding.pptx
stack coding.pptx
JamJahanzaib
 
Stacks, Queues, Deques
Stacks, Queues, DequesStacks, Queues, Deques
Stacks, Queues, Deques
A-Tech and Software Development
 
Queues - Data structure and algorithm.ppt
Queues - Data structure and algorithm.pptQueues - Data structure and algorithm.ppt
Queues - Data structure and algorithm.ppt
pandeylucky7500
 
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiQueues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
nikunjagarwal117
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
ArmanKhan382533
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
SupriyaGhosh43
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
Waf1231
 
Stack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparationStack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparation
RAtna29
 
stack presentation
stack presentationstack presentation
stack presentation
Shivalik college of engineering
 
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptxWINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
varunsarkar2004
 
Queues.ppt
Queues.pptQueues.ppt
Queues.ppt
soniya555961
 
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdfCEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
vtunali
 
StacksandQueues.pptnajaiananaajaoakanabjana
StacksandQueues.pptnajaiananaajaoakanabjanaStacksandQueues.pptnajaiananaajaoakanabjana
StacksandQueues.pptnajaiananaajaoakanabjana
suhas060606
 
GAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.pptGAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.ppt
CUO VEERANAN VEERANAN
 
Queues operation using data structure in c
Queues operation using data structure in cQueues operation using data structure in c
Queues operation using data structure in c
BalaKrishnan466
 
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.pptQueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
QueuYUGHIJLK;KJHGFCFYUGIHOJUHYGHJIOIHGes.ppt
GanaviBY
 
Queues in C++ detailed explanation and examples .ppt
Queues in C++ detailed explanation and examples .pptQueues in C++ detailed explanation and examples .ppt
Queues in C++ detailed explanation and examples .ppt
Jamiluddin39
 
Queues - Data structure and algorithm.ppt
Queues - Data structure and algorithm.pptQueues - Data structure and algorithm.ppt
Queues - Data structure and algorithm.ppt
pandeylucky7500
 
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiQueues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Queues.pptiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
nikunjagarwal117
 
Stacks.ppt
Stacks.pptStacks.ppt
Stacks.ppt
Waf1231
 
Stack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparationStack and Queue.pptx university exam preparation
Stack and Queue.pptx university exam preparation
RAtna29
 
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptxWINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
WINSEM2024-25_STS4022_SS_VL2024250500364_2024-12-21_Reference-Material-I.pptx
varunsarkar2004
 
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdfCEN 235 4. Abstract Data Types - Queue and Stack.pdf
CEN 235 4. Abstract Data Types - Queue and Stack.pdf
vtunali
 
StacksandQueues.pptnajaiananaajaoakanabjana
StacksandQueues.pptnajaiananaajaoakanabjanaStacksandQueues.pptnajaiananaajaoakanabjana
StacksandQueues.pptnajaiananaajaoakanabjana
suhas060606
 
GAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.pptGAC DS Priority Queue Presentation 2022.ppt
GAC DS Priority Queue Presentation 2022.ppt
CUO VEERANAN VEERANAN
 

More from ASU Online (20)

Midterm common mistakes
Midterm common mistakesMidterm common mistakes
Midterm common mistakes
ASU Online
 
Classes revision
Classes revisionClasses revision
Classes revision
ASU Online
 
For loop java 2
For loop java 2For loop java 2
For loop java 2
ASU Online
 
Reading and writting v2
Reading and writting v2Reading and writting v2
Reading and writting v2
ASU Online
 
Common errors v2
Common errors v2Common errors v2
Common errors v2
ASU Online
 
Common missunderestandings
Common missunderestandingsCommon missunderestandings
Common missunderestandings
ASU Online
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
ASU Online
 
Lecture 14 tourism in europe
Lecture 14   tourism in europeLecture 14   tourism in europe
Lecture 14 tourism in europe
ASU Online
 
Lecture 13 tourism in the south pacific
Lecture 13   tourism in the south pacificLecture 13   tourism in the south pacific
Lecture 13 tourism in the south pacific
ASU Online
 
Lecture 12 tourism in australia and new zealand
Lecture 12   tourism in australia and new zealandLecture 12   tourism in australia and new zealand
Lecture 12 tourism in australia and new zealand
ASU Online
 
Lecture 11 tourism in east asia
Lecture 11   tourism in east asiaLecture 11   tourism in east asia
Lecture 11 tourism in east asia
ASU Online
 
Lecture 9 tourism in south asia
Lecture 9   tourism in south asiaLecture 9   tourism in south asia
Lecture 9 tourism in south asia
ASU Online
 
Lecture 9 tourism in south asia-1
Lecture 9   tourism in south asia-1Lecture 9   tourism in south asia-1
Lecture 9 tourism in south asia-1
ASU Online
 
Lecture 8 tourism in central asia
Lecture 8   tourism in central asiaLecture 8   tourism in central asia
Lecture 8 tourism in central asia
ASU Online
 
Lecture 7 tourism in the middle east and north africa
Lecture 7   tourism in the middle east and north africaLecture 7   tourism in the middle east and north africa
Lecture 7 tourism in the middle east and north africa
ASU Online
 
Lecture 6 tourism in sub-saharan africa
Lecture 6   tourism in sub-saharan africaLecture 6   tourism in sub-saharan africa
Lecture 6 tourism in sub-saharan africa
ASU Online
 
Lecture 5 tourism in latin america
Lecture 5   tourism in latin americaLecture 5   tourism in latin america
Lecture 5 tourism in latin america
ASU Online
 
Lecture 4 tourism in the caribbean
Lecture 4   tourism in the caribbeanLecture 4   tourism in the caribbean
Lecture 4 tourism in the caribbean
ASU Online
 
Lecture 3 political context of international tourism
Lecture 3   political context of international tourismLecture 3   political context of international tourism
Lecture 3 political context of international tourism
ASU Online
 
Lecture 2 impacts of tourism global dist
Lecture 2 impacts of tourism   global distLecture 2 impacts of tourism   global dist
Lecture 2 impacts of tourism global dist
ASU Online
 
Midterm common mistakes
Midterm common mistakesMidterm common mistakes
Midterm common mistakes
ASU Online
 
Classes revision
Classes revisionClasses revision
Classes revision
ASU Online
 
For loop java 2
For loop java 2For loop java 2
For loop java 2
ASU Online
 
Reading and writting v2
Reading and writting v2Reading and writting v2
Reading and writting v2
ASU Online
 
Common errors v2
Common errors v2Common errors v2
Common errors v2
ASU Online
 
Common missunderestandings
Common missunderestandingsCommon missunderestandings
Common missunderestandings
ASU Online
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
ASU Online
 
Lecture 14 tourism in europe
Lecture 14   tourism in europeLecture 14   tourism in europe
Lecture 14 tourism in europe
ASU Online
 
Lecture 13 tourism in the south pacific
Lecture 13   tourism in the south pacificLecture 13   tourism in the south pacific
Lecture 13 tourism in the south pacific
ASU Online
 
Lecture 12 tourism in australia and new zealand
Lecture 12   tourism in australia and new zealandLecture 12   tourism in australia and new zealand
Lecture 12 tourism in australia and new zealand
ASU Online
 
Lecture 11 tourism in east asia
Lecture 11   tourism in east asiaLecture 11   tourism in east asia
Lecture 11 tourism in east asia
ASU Online
 
Lecture 9 tourism in south asia
Lecture 9   tourism in south asiaLecture 9   tourism in south asia
Lecture 9 tourism in south asia
ASU Online
 
Lecture 9 tourism in south asia-1
Lecture 9   tourism in south asia-1Lecture 9   tourism in south asia-1
Lecture 9 tourism in south asia-1
ASU Online
 
Lecture 8 tourism in central asia
Lecture 8   tourism in central asiaLecture 8   tourism in central asia
Lecture 8 tourism in central asia
ASU Online
 
Lecture 7 tourism in the middle east and north africa
Lecture 7   tourism in the middle east and north africaLecture 7   tourism in the middle east and north africa
Lecture 7 tourism in the middle east and north africa
ASU Online
 
Lecture 6 tourism in sub-saharan africa
Lecture 6   tourism in sub-saharan africaLecture 6   tourism in sub-saharan africa
Lecture 6 tourism in sub-saharan africa
ASU Online
 
Lecture 5 tourism in latin america
Lecture 5   tourism in latin americaLecture 5   tourism in latin america
Lecture 5 tourism in latin america
ASU Online
 
Lecture 4 tourism in the caribbean
Lecture 4   tourism in the caribbeanLecture 4   tourism in the caribbean
Lecture 4 tourism in the caribbean
ASU Online
 
Lecture 3 political context of international tourism
Lecture 3   political context of international tourismLecture 3   political context of international tourism
Lecture 3 political context of international tourism
ASU Online
 
Lecture 2 impacts of tourism global dist
Lecture 2 impacts of tourism   global distLecture 2 impacts of tourism   global dist
Lecture 2 impacts of tourism global dist
ASU Online
 
Ad

Recently uploaded (20)

IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
IT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information TechnologyIT488 Wireless Sensor Networks_Information Technology
IT488 Wireless Sensor Networks_Information Technology
SHEHABALYAMANI
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Config 2025 presentation recap covering both days
Config 2025 presentation recap covering both daysConfig 2025 presentation recap covering both days
Config 2025 presentation recap covering both days
TrishAntoni1
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?Shoehorning dependency injection into a FP language, what does it take?
Shoehorning dependency injection into a FP language, what does it take?
Eric Torreborre
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent LasterAI 3-in-1: Agents, RAG, and Local Models - Brent Laster
AI 3-in-1: Agents, RAG, and Local Models - Brent Laster
All Things Open
 
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Everything You Need to Know About Agentforce? (Put AI Agents to Work)
Cyntexa
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Ad

Lists, queues and stacks

  • 1. Lists, Queues, Stacks CST200 – Week 5: Array based Implementation Instructor: Andreea Molnar
  • 3. List A sequence of items that has at least the functionality below: • Accessing an item at a given position • Adding an item at a given position • Removing an item • Determining the number of items
  • 4. Stack A sequence of items in which: • • An item can be inserted only to the top Only the top item can be accessed/removed In a stack items are inserted and removed according to the last-in first-out (LIFO) principle.
  • 5. Stack Functionality: • • • • • push: insert an item to the top of the stack pop: remove the item at the top of the stack peek: get the item at the top of the stack isEmpty: assess if the stack is empty isFull: assess if the stack is full
  • 6. Stack Assuming that one has an object myStack: myStack.push (25) 25 mySta ck
  • 7. Stack Assuming that one has an object myStack: myStack.push (25) myStack.push (10) 10 25 mySta ck
  • 8. Stack Assuming that one has an object myStack: myStack.push (25) myStack.push (10) 10 25 mySta ck int topValue = myStack.pop () 10 topVa lue
  • 9. Stack Assuming that one has an object myStack: myStack.push (25) myStack.push (10) int topValue = myStack.pop () 5 25 mySta ck myStack.push (5) 10 topVa lue
  • 10. Stack Assuming that one has an object myStack myStack.push (25) myStack.push (10) 5 25 mySta ck int topValue = myStack.pop () myStack.push (5) 10 topVa lue
  • 11. Stack Assuming that one has an object myStack: myStack.push (25) myStack.push (10) int topValue = myStack.pop () myStack.push (5) myStack.push (20) 20 5 25 10 mySta ck topVa lue
  • 12. Stack Assuming that one has an object myStack: myStack.push (25) myStack.push (10) int topValue = myStack.pop () myStack.push (5) myStack.push (20) topValue = myStack.pop () 20 5 25 20 mySta ck topVa lue
  • 13. Queue A sequence of items in which the first element inserted is the first one to be removed. In a queue elements are inserted and removed based on the the first-in first-out (FIFO) principle.
  • 14. Queue Functionality: • • • enqueue: add an item to the back of the queue dequeue: remove the front item getFront: get the front item
  • 15. Queue Assuming that one has an object myQueue: myQueue.enque (25) 25 myQue ue
  • 16. Queue Assuming that one has an object myQueue: myQueue.enque (25) int value = myQueue.deque () 25 25 myQue ue value
  • 17. Queue Assuming that one has an object myQueue: myQueue.enque (25) int value = myQueue.deque () 20 myQueue.enque (20) 25 myQue ue value
  • 18. Queue Assuming that one has an object myQueue: myQueue.enque (25) int value = myQueue.deque () myQueue.enque (20) 20 5 myQue ue myQueue.enque (5) 25 value
  • 19. Queue Assuming that one has an object myQueue: myQueue.enque (25) int value = myQueue.deque () myQueue.enque (20) 20 5 myQueue.enque (5) value = myQueue.deque () 20 myQue ue value
  • 20. Summary • • • A list is sequence of items that allows to access, add and remove an arbitrary element and determine the numbers of items (length/size of the list). A stack is a data structure in which an item can be added, accessed or removed only from the top. A queue is a data structure in which the first element added is the first one to be accessed/removed.
  翻译: