SlideShare a Scribd company logo
Data Structures and
Algorithms
Week 3: Stack and Queues
Ferdin Joe John Joseph, PhD
Faculty of Information Technology
Thai-Nichi Institute of Technology, Bangkok
Week 3
• Stack
• Queues
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
2
Developing an ADT
• ADT stack operations
• Create an empty stack
• Determine whether a stack is empty
• Add a new item to the stack
• Remove from the stack the item that was added most
recently
• Remove all the items from the stack
• Retrieve from the stack the item that was added most
recently
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
3
Developing an ADT During the
Design of a Solution
• A stack
• Last-in, first-out (LIFO)
property
• The last item placed on
the stack will be the
first item removed
• Analogy
• A stack of dishes in a
cafeteria
Stack of cafeteria dishes
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
7A-4
Refining the Definition of the ADT
Stack
• Pseudocode for the ADT stack operations
createStack()
// Creates an empty stack.
isEmpty()
// Determines whether a stack is empty.
push(newItem) throws StackException
// Adds newItem to the top of the stack.
// Throws StackException if the insertion is
// not successful.
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
5
Refining the Definition of the ADT
Stack
• Pseudocode for the ADT stack operations (Cont)
pop() throws StackException
// Retrieves and then removes the top of the stack.
// Throws StackException if the deletion is not
// successful.
popAll()
// Removes all items from the stack.
peek() throws StackException
// Retrieves the top of the stack. Throws
// StackException if the retrieval is not successful
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
6
Simple Applications of the ADT Stack:
Checking for Balanced Braces
• A stack can be used to verify whether a program
contains balanced braces
• An example of balanced braces
abc{defg{ijk}{l{mn}}op}qr
• An example of unbalanced braces
abc{def}}{ghij{kl}m
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
7
Checking for Balanced Braces
• Requirements for balanced braces
• Each time you encounter a "{", push it on the stack
• Each time you encounter a “}”, it matches an already
encountered “{”, pop "{" off the stack
• When you reach the end of the string, you should have
matched each “{” and the stack should be empty
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
8
Checking for Balanced Braces
Traces of the algorithm that checks for balanced braces
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
9
Implementations of the ADT Stack
• The ADT stack can be implemented using
• An array
• A linked list
• The ADT list in the JCF
• StackInterface
• Provides a common specification for the three
implementations
• StackException
• Used by StackInterface
• Extends java.lang.RuntimeException
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
10
Implementations of the ADT Stack
Implementation of the
ADT stack that use a)
an array; b) a linked list;
c) an ADT list
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
11
An Array-Based Implementation of
the ADT Stack
• StackArrayBased class
• Implements StackInterface
• Instances
• Stacks
• Private data fields
• An array of Objects called items
• The index top
An array-based implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
12
A Reference-Based
Implementation of the ADT Stack
A reference-based
implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
13
Comparing Implementations
• All of the three implementations are ultimately
array based or reference based
• Fixed size versus dynamic size
• An array-based implementation
• Uses fixed-sized arrays
• Prevents the push operation from adding an item to the stack if
the stack’s size limit has been reached
• A reference-based implementation
• Does not put a limit on the size of the stack
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
14
Evaluating Postfix Expressions
• A postfix calculator
• Requires you to enter postfix expressions
• Example: 2 3 4 + * (= 2*(3+4))
• When an operand is entered, the calculator
• Pushes it onto a stack
• When an operator is entered, the calculator
• Applies it to the top two operands of the stack
• Pops the operands from the stack
• Pushes the result of the operation on the stack
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
15
Evaluating Postfix Expressions
The action of a postfix calculator when evaluating the expression 2 * (3 + 4)
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
16
Evaluating Postfix Expressions
• To evaluate a postfix expression which is entered as
a string of characters
• Simplifying assumptions
• The string is a syntactically correct postfix expression
• No unary operators are present
• No exponentiation operators are present
• Operands are single lowercase letters that represent integer
values
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
17
Converting Infix Expressions to
Equivalent Postfix Expressions
• An infix expression can be evaluated by first being converted
into an equivalent postfix expression
• Facts about converting from infix to postfix
• Operands always stay in the same order with respect to one
another
• An operator will move only “to the right” with respect to the
operands
• All parentheses are removed
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
18
Converting Infix Expressions to
Equivalent Postfix Expressions
A trace of the algorithm that converts the infix expression a - (b + c * d)/e to postfix form
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
19
Java Implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
20
Week 3
• Stack
• Queues
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
21
The Abstract Data Type Queue
• A queue
• New items enter at the back, or rear, of the queue
• Items leave from the front of the queue
• First-in, first-out (FIFO) property
• The first item inserted into a queue is the first item to leave
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
22
The Abstract Data Type Queue
• ADT queue operations
• Create an empty queue
• Determine whether a queue is empty
• Add a new item to the queue
• Remove from the queue the item that was added
earliest
• Remove all the items from the queue
• Retrieve from the queue the item that was added
earliest
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
23
The Abstract Data Type Queue
• Queues
• Are appropriate for many real-world situations
• Example: A line to buy a movie ticket
• Have applications in computer science
• Example: A request to print a document
• A simulation
• Discrete event simulator
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
24
The Abstract Data Type Queue
• Pseudocode for the ADT queue operations
createQueue()
// Creates an empty queue.
isEmpty()
// Determines whether a queue is empty
enqueue(newItem) throws QueueException
// Adds newItem at the back of a queue. Throws
// QueueException if the operation is not
// successful
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
25
The Abstract Data Type Queue
• Pseudocode for the ADT queue operations (Cont)
dequeue() throws QueueException
// Retrieves and removes the front of a queue.
// Throws QueueException if the operation is
// not successful.
dequeueAll()
// Removes all items from a queue
peek() throws QueueException
// Retrieves the front of a queue. Throws
// QueueException if the retrieval is not
// successful
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
26
The Abstract Data Type Queue
Some queue operations
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
27
Simple Applications of the ADT
Queue: Reading a String of
Characters
• A queue can retain characters in the order in
which they are typed
queue.createQueue()
while (not end of line) {
Read a new character ch
queue.enqueue(ch)
}
• Once the characters are in a queue, the system can
process them as necessary
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
28
Recognizing Palindromes
• A palindrome
• A string of characters that reads the same from left to
right as its does from right to left
• To recognize a palindrome, a queue can be used in
conjunction with a stack
• A stack can be used to reverse the order of occurrences
• A queue can be used to preserve the order of
occurrences
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
29
Recognizing Palindromes
• A nonrecursive recognition
algorithm for palindromes
• As you traverse the
character string from left to
right, insert each character
into both a queue and a
stack
• Compare the characters at
the front of the queue and
the top of the stack
The results of inserting a string
into both a queue and a stack
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
7A-30
Implementations of the ADT
Queue
• A queue can have either
• An array-based implementation
• A reference-based implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
31
A Reference-Based Implementation
• Possible implementations of a queue
• A linear linked list with two external references
• A reference to the front
• A reference to the back
A reference-based implementation of a queue: a) a linear linked list with two
external references
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
7A-32
A Reference-Based Implementation
• Possible implementations of a queue (Continued)
• A circular linked list with one external reference
• A reference to the back
A reference-based implementation of a queue: b) a circular linear linked list with one
external reference
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
7A-33
A Reference-Based
Implementation
Inserting an item into a nonempty queue
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
34
A Reference-Based
Implementation
Inserting an item into an empty queue: a) before insertion; b) after insertion
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
35
A Reference-Based
Implementation
Deleting an item from a queue of more than one item
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
36
An Implementation That Uses the
ADT List
• If the item in position 1 of a list list represents
the front of the queue, the following
implementations can be used
• dequeue()
list.remove(1)
• peek()
list.get(1)
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
37
An Implementation That Uses the
ADT List
• If the item at the end of the list represents the
back of the queue, the following implementations
can be used
• enqueue(newItem)
list.add(list.size()+1, newItem)
An implementation that uses the ADT list
Lecture series for Data Structures and
Algorithms, Data Science and Analytics, Thai-
Nichi Institute of Technology
7A-38
Application: Simulation
A blank line at at time a) 0; b) 12
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
39
Application: Simulation
A blank line at at time c) 20; d) 38
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
40
Java Implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
41
The ADT Priority Queue
• Organize data by priorities
• Example: weekly “to do” list
• Priority value
• We will say high value  high priority
• Operations
• Test for empty
• Add to queue in sorted position
• Remove/get entry with highest priority
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
42
Real-life Priority Queue
• Example : triage in a hospital emergency room
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
43
Real-life Priority Queue
• Example : Public Transport in Thailand
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
44
Priority Queue
A priority queue is an ADT with the property that
only the highest-priority element can be accessed
at any time.
Queue
Enque an item
Item returned has been in the queue the
longest amount of time.
Priority Queue
Enque a pair <item, priority>
Item returned has the highest priority.
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
45
Tracking Your Assignments
• Pseudocode to organize assignments,
responsibilities
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
46
Application: Simulation
• Simulation models behavior of systems
• Problem to solve
• Approximate average time bank customer must wait for
service from a teller
• Decrease in customer wait time with each new teller added
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
47
Application: Simulation
• Sample arrival and transaction times
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
48
Application: Simulation
• A bank line at time (a) 0; (b) 20; (c) 22; (d) 26
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
49
Application: Simulation
• A bank line at time (a) 0; (b) 20; (c) 22; (d) 26
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
50
Application: Simulation
• Pseudocode for an event loop
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
51
Application: Simulation
• Time-driven simulation
• Simulates the ticking of a clock
• Event-driven simulation considers
• Only the times of certain events,
• In this case, arrival-s and departures
• Event list contains
• All future arrival and departure events
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
52
Application: Simulation
• A typical instance of (a) an arrival event;
(b) a departure event
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
53
Application: Simulation
• Two tasks required to process each event
• Update the bank line: Add or remove customers
• Update the event queue: Add or remove events
• New customer
• Always enters bank line
• Served while at the front of the line
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
54
Application: Simulation
• A trace of the bank simulation algorithm for the data
(20, 6), (22, 4), (23, 2), (30, 3)
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
55
Java Implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
56
Java Implementation
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
57
Activity - Graded
• Create a priority queue code using Java for
implementing Visa on Arrival passengers. Priority
should be of order below
• Elderly 55+
• Pregnant Women
• Differently abled
• Women with infants
Code should be submitted to canvas portal before
next class. Those who complete by today’s class will
receive a bonus point.
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
58
Next Week
Tree ADT and its applications
Tree Traversals
Binary Trees
Implementation in Java
Lecture series for Data Structures and
Algorithms, Data Science and Analytics,
Thai-Nichi Institute of Technology
59

More Related Content

What's hot

Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
imtiazalijoono
 
Array ADT(Abstract Data Type)|Data Structure
Array ADT(Abstract Data Type)|Data StructureArray ADT(Abstract Data Type)|Data Structure
Array ADT(Abstract Data Type)|Data Structure
Akash Gaur
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
Dattatray Gandhmal
 
Python for Beginners(v3)
Python for Beginners(v3)Python for Beginners(v3)
Python for Beginners(v3)
Panimalar Engineering College
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
Emertxe Information Technologies Pvt Ltd
 
Array
ArrayArray
Python data type
Python data typePython data type
Python data type
nuripatidar
 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
Dr. Jasmine Beulah Gnanadurai
 
Interpolation search
Interpolation searchInterpolation search
Interpolation search
Usr11011
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
allyn joy calcaben
 
Python for loop
Python for loopPython for loop
Python for loop
Aishwarya Deshmukh
 
Namespaces
NamespacesNamespaces
Namespaces
Sangeetha S
 
Linked lists
Linked listsLinked lists
Linked lists
SARITHA REDDY
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
University of Science and Technology Chitttagong
 
Array
ArrayArray
Tuples in Python
Tuples in PythonTuples in Python
Tuples in Python
DPS Ranipur Haridwar UK
 
Python programming : Arrays
Python programming : ArraysPython programming : Arrays
Python programming : Arrays
Emertxe Information Technologies Pvt Ltd
 
Arrays
ArraysArrays
String in python use of split method
String in python use of split methodString in python use of split method
String in python use of split method
vikram mahendra
 

What's hot (20)

Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Array ADT(Abstract Data Type)|Data Structure
Array ADT(Abstract Data Type)|Data StructureArray ADT(Abstract Data Type)|Data Structure
Array ADT(Abstract Data Type)|Data Structure
 
Role-of-lexical-analysis
Role-of-lexical-analysisRole-of-lexical-analysis
Role-of-lexical-analysis
 
Python for Beginners(v3)
Python for Beginners(v3)Python for Beginners(v3)
Python for Beginners(v3)
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
 
Array
ArrayArray
Array
 
Python data type
Python data typePython data type
Python data type
 
Stacks and Queue - Data Structures
Stacks and Queue - Data StructuresStacks and Queue - Data Structures
Stacks and Queue - Data Structures
 
Interpolation search
Interpolation searchInterpolation search
Interpolation search
 
CMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of FunctionsCMSC 56 | Lecture 8: Growth of Functions
CMSC 56 | Lecture 8: Growth of Functions
 
Python for loop
Python for loopPython for loop
Python for loop
 
single linked list
single linked listsingle linked list
single linked list
 
Namespaces
NamespacesNamespaces
Namespaces
 
Linked lists
Linked listsLinked lists
Linked lists
 
Insertion sort algorithm power point presentation
Insertion  sort algorithm power point presentation Insertion  sort algorithm power point presentation
Insertion sort algorithm power point presentation
 
Array
ArrayArray
Array
 
Tuples in Python
Tuples in PythonTuples in Python
Tuples in Python
 
Python programming : Arrays
Python programming : ArraysPython programming : Arrays
Python programming : Arrays
 
Arrays
ArraysArrays
Arrays
 
String in python use of split method
String in python use of split methodString in python use of split method
String in python use of split method
 

Similar to Data Structures and Algorithm - Week 3 - Stacks and Queues

Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
MumitAhmed1
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
SharabiNaif
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
Anonymous9etQKwW
 
Queue
QueueQueue
Week 1 - Data Structures and Algorithms
Week 1 - Data Structures and AlgorithmsWeek 1 - Data Structures and Algorithms
Week 1 - Data Structures and Algorithms
Ferdin Joe John Joseph PhD
 
stacks and queues class 12 in c++
stacks and  queues class 12 in c++stacks and  queues class 12 in c++
stacks and queues class 12 in c++
Khushal Mehta
 
Week2: Programming for Data Analysis
Week2: Programming for Data AnalysisWeek2: Programming for Data Analysis
Week2: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Data Structures
Data StructuresData Structures
Data Structures
Dr.Umadevi V
 
2 a stacks
2 a stacks2 a stacks
2 a stacks
Nguync91368
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
iqbalphy1
 
Week 1: Programming for Data Analysis
Week 1: Programming for Data AnalysisWeek 1: Programming for Data Analysis
Week 1: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
YaminiLakshmi Meduri
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
SnehilKeshari
 
stack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptxstack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptx
HusnainNaqvi2
 
Week 9: Programming for Data Analysis
Week 9: Programming for Data AnalysisWeek 9: Programming for Data Analysis
Week 9: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Data Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search AlgorithmsData Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search Algorithms
Ferdin Joe John Joseph PhD
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
Yonas D. Ebren
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
sabithabanu83
 

Similar to Data Structures and Algorithm - Week 3 - Stacks and Queues (20)

Intro_2.ppt
Intro_2.pptIntro_2.ppt
Intro_2.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Intro.ppt
Intro.pptIntro.ppt
Intro.ppt
 
Queue
QueueQueue
Queue
 
Week 1 - Data Structures and Algorithms
Week 1 - Data Structures and AlgorithmsWeek 1 - Data Structures and Algorithms
Week 1 - Data Structures and Algorithms
 
stacks and queues class 12 in c++
stacks and  queues class 12 in c++stacks and  queues class 12 in c++
stacks and queues class 12 in c++
 
Week2: Programming for Data Analysis
Week2: Programming for Data AnalysisWeek2: Programming for Data Analysis
Week2: Programming for Data Analysis
 
Data Structures
Data StructuresData Structures
Data Structures
 
2 a stacks
2 a stacks2 a stacks
2 a stacks
 
stacks and queues for public
stacks and queues for publicstacks and queues for public
stacks and queues for public
 
Data Wrangling Week 4
Data Wrangling Week 4Data Wrangling Week 4
Data Wrangling Week 4
 
Week 1: Programming for Data Analysis
Week 1: Programming for Data AnalysisWeek 1: Programming for Data Analysis
Week 1: Programming for Data Analysis
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
 
stack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptxstack_presentaton_HUSNAIN[2].pojklklklptx
stack_presentaton_HUSNAIN[2].pojklklklptx
 
Week 9: Programming for Data Analysis
Week 9: Programming for Data AnalysisWeek 9: Programming for Data Analysis
Week 9: Programming for Data Analysis
 
Data Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search AlgorithmsData Structures and Algorithm - Week 9 - Search Algorithms
Data Structures and Algorithm - Week 9 - Search Algorithms
 
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 

More from Ferdin Joe John Joseph PhD

Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022
Ferdin Joe John Joseph PhD
 
Week 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud ComputingWeek 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Ferdin Joe John Joseph PhD
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Ferdin Joe John Joseph PhD
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Ferdin Joe John Joseph PhD
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Ferdin Joe John Joseph PhD
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Ferdin Joe John Joseph PhD
 
Hadoop in Alibaba Cloud
Hadoop in Alibaba CloudHadoop in Alibaba Cloud
Hadoop in Alibaba Cloud
Ferdin Joe John Joseph PhD
 
Cloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba CloudCloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba Cloud
Ferdin Joe John Joseph PhD
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approach
Ferdin Joe John Joseph PhD
 
Week 11: Programming for Data Analysis
Week 11: Programming for Data AnalysisWeek 11: Programming for Data Analysis
Week 11: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Week 10: Programming for Data Analysis
Week 10: Programming for Data AnalysisWeek 10: Programming for Data Analysis
Week 10: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Week 8: Programming for Data Analysis
Week 8: Programming for Data AnalysisWeek 8: Programming for Data Analysis
Week 8: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Programming for Data Analysis: Week 4
Programming for Data Analysis: Week 4Programming for Data Analysis: Week 4
Programming for Data Analysis: Week 4
Ferdin Joe John Joseph PhD
 

More from Ferdin Joe John Joseph PhD (20)

Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022Invited Talk DGTiCon 2022
Invited Talk DGTiCon 2022
 
Week 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud ComputingWeek 12: Cloud AI- DSA 441 Cloud Computing
Week 12: Cloud AI- DSA 441 Cloud Computing
 
Week 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud ComputingWeek 11: Cloud Native- DSA 441 Cloud Computing
Week 11: Cloud Native- DSA 441 Cloud Computing
 
Week 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud ComputingWeek 10: Cloud Security- DSA 441 Cloud Computing
Week 10: Cloud Security- DSA 441 Cloud Computing
 
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
Week 9: Relational Database Service Alibaba Cloud- DSA 441 Cloud Computing
 
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud ComputingWeek 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
Week 7: Object Storage Service Alibaba Cloud- DSA 441 Cloud Computing
 
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
Week 6: Server Load Balancer and Auto Scaling Alibaba Cloud- DSA 441 Cloud Co...
 
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
Week 5: Elastic Compute Service (ECS) with Alibaba Cloud- DSA 441 Cloud Compu...
 
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud ComputingWeek 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
Week 4: Big Data and Hadoop in Alibaba Cloud - DSA 441 Cloud Computing
 
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
Week 3: Virtual Private Cloud, On Premise, IaaS, PaaS, SaaS - DSA 441 Cloud C...
 
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud ComputingWeek 2: Virtualization and VM Ware - DSA 441 Cloud Computing
Week 2: Virtualization and VM Ware - DSA 441 Cloud Computing
 
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud ComputingWeek 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
Week 1: Introduction to Cloud Computing - DSA 441 Cloud Computing
 
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculumSept 6 2021 BTech Artificial Intelligence and Data Science curriculum
Sept 6 2021 BTech Artificial Intelligence and Data Science curriculum
 
Hadoop in Alibaba Cloud
Hadoop in Alibaba CloudHadoop in Alibaba Cloud
Hadoop in Alibaba Cloud
 
Cloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba CloudCloud Computing Essentials in Alibaba Cloud
Cloud Computing Essentials in Alibaba Cloud
 
Transforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approachTransforming deep into transformers – a computer vision approach
Transforming deep into transformers – a computer vision approach
 
Week 11: Programming for Data Analysis
Week 11: Programming for Data AnalysisWeek 11: Programming for Data Analysis
Week 11: Programming for Data Analysis
 
Week 10: Programming for Data Analysis
Week 10: Programming for Data AnalysisWeek 10: Programming for Data Analysis
Week 10: Programming for Data Analysis
 
Week 8: Programming for Data Analysis
Week 8: Programming for Data AnalysisWeek 8: Programming for Data Analysis
Week 8: Programming for Data Analysis
 
Programming for Data Analysis: Week 4
Programming for Data Analysis: Week 4Programming for Data Analysis: Week 4
Programming for Data Analysis: Week 4
 

Recently uploaded

Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
AnirbanRoy608946
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTESAdjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Subhajit Sahu
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 

Recently uploaded (20)

Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTESAdjusting OpenMP PageRank : SHORT REPORT / NOTES
Adjusting OpenMP PageRank : SHORT REPORT / NOTES
 
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 

Data Structures and Algorithm - Week 3 - Stacks and Queues

  • 1. Data Structures and Algorithms Week 3: Stack and Queues Ferdin Joe John Joseph, PhD Faculty of Information Technology Thai-Nichi Institute of Technology, Bangkok
  • 2. Week 3 • Stack • Queues Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 2
  • 3. Developing an ADT • ADT stack operations • Create an empty stack • Determine whether a stack is empty • Add a new item to the stack • Remove from the stack the item that was added most recently • Remove all the items from the stack • Retrieve from the stack the item that was added most recently Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 3
  • 4. Developing an ADT During the Design of a Solution • A stack • Last-in, first-out (LIFO) property • The last item placed on the stack will be the first item removed • Analogy • A stack of dishes in a cafeteria Stack of cafeteria dishes Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 7A-4
  • 5. Refining the Definition of the ADT Stack • Pseudocode for the ADT stack operations createStack() // Creates an empty stack. isEmpty() // Determines whether a stack is empty. push(newItem) throws StackException // Adds newItem to the top of the stack. // Throws StackException if the insertion is // not successful. Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 5
  • 6. Refining the Definition of the ADT Stack • Pseudocode for the ADT stack operations (Cont) pop() throws StackException // Retrieves and then removes the top of the stack. // Throws StackException if the deletion is not // successful. popAll() // Removes all items from the stack. peek() throws StackException // Retrieves the top of the stack. Throws // StackException if the retrieval is not successful Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 6
  • 7. Simple Applications of the ADT Stack: Checking for Balanced Braces • A stack can be used to verify whether a program contains balanced braces • An example of balanced braces abc{defg{ijk}{l{mn}}op}qr • An example of unbalanced braces abc{def}}{ghij{kl}m Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 7
  • 8. Checking for Balanced Braces • Requirements for balanced braces • Each time you encounter a "{", push it on the stack • Each time you encounter a “}”, it matches an already encountered “{”, pop "{" off the stack • When you reach the end of the string, you should have matched each “{” and the stack should be empty Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 8
  • 9. Checking for Balanced Braces Traces of the algorithm that checks for balanced braces Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 9
  • 10. Implementations of the ADT Stack • The ADT stack can be implemented using • An array • A linked list • The ADT list in the JCF • StackInterface • Provides a common specification for the three implementations • StackException • Used by StackInterface • Extends java.lang.RuntimeException Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 10
  • 11. Implementations of the ADT Stack Implementation of the ADT stack that use a) an array; b) a linked list; c) an ADT list Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 11
  • 12. An Array-Based Implementation of the ADT Stack • StackArrayBased class • Implements StackInterface • Instances • Stacks • Private data fields • An array of Objects called items • The index top An array-based implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 12
  • 13. A Reference-Based Implementation of the ADT Stack A reference-based implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 13
  • 14. Comparing Implementations • All of the three implementations are ultimately array based or reference based • Fixed size versus dynamic size • An array-based implementation • Uses fixed-sized arrays • Prevents the push operation from adding an item to the stack if the stack’s size limit has been reached • A reference-based implementation • Does not put a limit on the size of the stack Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 14
  • 15. Evaluating Postfix Expressions • A postfix calculator • Requires you to enter postfix expressions • Example: 2 3 4 + * (= 2*(3+4)) • When an operand is entered, the calculator • Pushes it onto a stack • When an operator is entered, the calculator • Applies it to the top two operands of the stack • Pops the operands from the stack • Pushes the result of the operation on the stack Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 15
  • 16. Evaluating Postfix Expressions The action of a postfix calculator when evaluating the expression 2 * (3 + 4) Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 16
  • 17. Evaluating Postfix Expressions • To evaluate a postfix expression which is entered as a string of characters • Simplifying assumptions • The string is a syntactically correct postfix expression • No unary operators are present • No exponentiation operators are present • Operands are single lowercase letters that represent integer values Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 17
  • 18. Converting Infix Expressions to Equivalent Postfix Expressions • An infix expression can be evaluated by first being converted into an equivalent postfix expression • Facts about converting from infix to postfix • Operands always stay in the same order with respect to one another • An operator will move only “to the right” with respect to the operands • All parentheses are removed Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 18
  • 19. Converting Infix Expressions to Equivalent Postfix Expressions A trace of the algorithm that converts the infix expression a - (b + c * d)/e to postfix form Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 19
  • 20. Java Implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 20
  • 21. Week 3 • Stack • Queues Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 21
  • 22. The Abstract Data Type Queue • A queue • New items enter at the back, or rear, of the queue • Items leave from the front of the queue • First-in, first-out (FIFO) property • The first item inserted into a queue is the first item to leave Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 22
  • 23. The Abstract Data Type Queue • ADT queue operations • Create an empty queue • Determine whether a queue is empty • Add a new item to the queue • Remove from the queue the item that was added earliest • Remove all the items from the queue • Retrieve from the queue the item that was added earliest Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 23
  • 24. The Abstract Data Type Queue • Queues • Are appropriate for many real-world situations • Example: A line to buy a movie ticket • Have applications in computer science • Example: A request to print a document • A simulation • Discrete event simulator Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 24
  • 25. The Abstract Data Type Queue • Pseudocode for the ADT queue operations createQueue() // Creates an empty queue. isEmpty() // Determines whether a queue is empty enqueue(newItem) throws QueueException // Adds newItem at the back of a queue. Throws // QueueException if the operation is not // successful Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 25
  • 26. The Abstract Data Type Queue • Pseudocode for the ADT queue operations (Cont) dequeue() throws QueueException // Retrieves and removes the front of a queue. // Throws QueueException if the operation is // not successful. dequeueAll() // Removes all items from a queue peek() throws QueueException // Retrieves the front of a queue. Throws // QueueException if the retrieval is not // successful Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 26
  • 27. The Abstract Data Type Queue Some queue operations Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 27
  • 28. Simple Applications of the ADT Queue: Reading a String of Characters • A queue can retain characters in the order in which they are typed queue.createQueue() while (not end of line) { Read a new character ch queue.enqueue(ch) } • Once the characters are in a queue, the system can process them as necessary Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 28
  • 29. Recognizing Palindromes • A palindrome • A string of characters that reads the same from left to right as its does from right to left • To recognize a palindrome, a queue can be used in conjunction with a stack • A stack can be used to reverse the order of occurrences • A queue can be used to preserve the order of occurrences Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 29
  • 30. Recognizing Palindromes • A nonrecursive recognition algorithm for palindromes • As you traverse the character string from left to right, insert each character into both a queue and a stack • Compare the characters at the front of the queue and the top of the stack The results of inserting a string into both a queue and a stack Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 7A-30
  • 31. Implementations of the ADT Queue • A queue can have either • An array-based implementation • A reference-based implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 31
  • 32. A Reference-Based Implementation • Possible implementations of a queue • A linear linked list with two external references • A reference to the front • A reference to the back A reference-based implementation of a queue: a) a linear linked list with two external references Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 7A-32
  • 33. A Reference-Based Implementation • Possible implementations of a queue (Continued) • A circular linked list with one external reference • A reference to the back A reference-based implementation of a queue: b) a circular linear linked list with one external reference Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 7A-33
  • 34. A Reference-Based Implementation Inserting an item into a nonempty queue Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 34
  • 35. A Reference-Based Implementation Inserting an item into an empty queue: a) before insertion; b) after insertion Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 35
  • 36. A Reference-Based Implementation Deleting an item from a queue of more than one item Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 36
  • 37. An Implementation That Uses the ADT List • If the item in position 1 of a list list represents the front of the queue, the following implementations can be used • dequeue() list.remove(1) • peek() list.get(1) Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 37
  • 38. An Implementation That Uses the ADT List • If the item at the end of the list represents the back of the queue, the following implementations can be used • enqueue(newItem) list.add(list.size()+1, newItem) An implementation that uses the ADT list Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai- Nichi Institute of Technology 7A-38
  • 39. Application: Simulation A blank line at at time a) 0; b) 12 Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 39
  • 40. Application: Simulation A blank line at at time c) 20; d) 38 Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 40
  • 41. Java Implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 41
  • 42. The ADT Priority Queue • Organize data by priorities • Example: weekly “to do” list • Priority value • We will say high value  high priority • Operations • Test for empty • Add to queue in sorted position • Remove/get entry with highest priority Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 42
  • 43. Real-life Priority Queue • Example : triage in a hospital emergency room Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 43
  • 44. Real-life Priority Queue • Example : Public Transport in Thailand Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 44
  • 45. Priority Queue A priority queue is an ADT with the property that only the highest-priority element can be accessed at any time. Queue Enque an item Item returned has been in the queue the longest amount of time. Priority Queue Enque a pair <item, priority> Item returned has the highest priority. Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 45
  • 46. Tracking Your Assignments • Pseudocode to organize assignments, responsibilities Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 46
  • 47. Application: Simulation • Simulation models behavior of systems • Problem to solve • Approximate average time bank customer must wait for service from a teller • Decrease in customer wait time with each new teller added Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 47
  • 48. Application: Simulation • Sample arrival and transaction times Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 48
  • 49. Application: Simulation • A bank line at time (a) 0; (b) 20; (c) 22; (d) 26 Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 49
  • 50. Application: Simulation • A bank line at time (a) 0; (b) 20; (c) 22; (d) 26 Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 50
  • 51. Application: Simulation • Pseudocode for an event loop Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 51
  • 52. Application: Simulation • Time-driven simulation • Simulates the ticking of a clock • Event-driven simulation considers • Only the times of certain events, • In this case, arrival-s and departures • Event list contains • All future arrival and departure events Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 52
  • 53. Application: Simulation • A typical instance of (a) an arrival event; (b) a departure event Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 53
  • 54. Application: Simulation • Two tasks required to process each event • Update the bank line: Add or remove customers • Update the event queue: Add or remove events • New customer • Always enters bank line • Served while at the front of the line Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 54
  • 55. Application: Simulation • A trace of the bank simulation algorithm for the data (20, 6), (22, 4), (23, 2), (30, 3) Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 55
  • 56. Java Implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 56
  • 57. Java Implementation Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 57
  • 58. Activity - Graded • Create a priority queue code using Java for implementing Visa on Arrival passengers. Priority should be of order below • Elderly 55+ • Pregnant Women • Differently abled • Women with infants Code should be submitted to canvas portal before next class. Those who complete by today’s class will receive a bonus point. Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 58
  • 59. Next Week Tree ADT and its applications Tree Traversals Binary Trees Implementation in Java Lecture series for Data Structures and Algorithms, Data Science and Analytics, Thai-Nichi Institute of Technology 59