You are on page 1of 43

Algorithmic and advanced

Programming in Python

Eric Benhamou eric.benhamou@dauphine.eu


Remy Belmonte remy.belmonte@dauphine.eu
Masterclass 2
Electronic copy available at: https://ssrn.com/abstract=3953786
Reminder of the objective of this course
• People often learn about data structures out of context
• But in this course you will learn foundational concepts by building a
real application with python and Flask (we will start in session 3)!

• To learn the ins and outs of the essential data structure, experiencing in
practice has proved to be a much more powerful way to learn data
structures

Algorithmic and advanced Programming in Python 2


Electronic copy available at: https://ssrn.com/abstract=3953786
Outline
1. Stack
a) Concepts
b) Implementation choice
c) Corresponding codes
2. Queue
a) Concepts
b) Implementation choice
c) Corresponding codes

Algorithmic and advanced Programming in Python 3


Electronic copy available at: https://ssrn.com/abstract=3953786
What is a stack

Algorithmic and advanced Programming in Python 4


Electronic copy available at: https://ssrn.com/abstract=3953786
Special names

Algorithmic and advanced Programming in Python 5


Electronic copy available at: https://ssrn.com/abstract=3953786
How stack are used?

Algorithmic and advanced Programming in Python 6


Electronic copy available at: https://ssrn.com/abstract=3953786
Stack advanced data structure

Algorithmic and advanced Programming in Python 7


Electronic copy available at: https://ssrn.com/abstract=3953786
Direct applications

Algorithmic and advanced Programming in Python 8


Electronic copy available at: https://ssrn.com/abstract=3953786
Implementation

Algorithmic and advanced Programming in Python 9


Electronic copy available at: https://ssrn.com/abstract=3953786
Simple array implementation

Algorithmic and advanced Programming in Python 10


Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 11
Electronic copy available at: https://ssrn.com/abstract=3953786
Performance and limitations?

Algorithmic and advanced Programming in Python 12


Electronic copy available at: https://ssrn.com/abstract=3953786
Limitations?

Algorithmic and advanced Programming in Python 13


Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 14
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 15
Electronic copy available at: https://ssrn.com/abstract=3953786
Question compute the complexity?

Algorithmic and advanced Programming in Python 16


Electronic copy available at: https://ssrn.com/abstract=3953786
Solution

Algorithmic and advanced Programming in Python 17


Electronic copy available at: https://ssrn.com/abstract=3953786
Implementation

Algorithmic and advanced Programming in Python 18


Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Performance

Algorithmic and advanced Programming in Python 20


Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 21
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 22
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 23
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 26
Electronic copy available at: https://ssrn.com/abstract=3953786
Queue

Algorithmic and advanced Programming in Python 27


Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python 28
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
Algorithmic and advanced Programming in Python
Electronic copy available at: https://ssrn.com/abstract=3953786
In Lab session
• You will play with the concepts and starts getting more and more
familiar with how this works in real life
• This will be useful for your project

• Lab is done by Remy Belmonte

Algorithmic and advanced Programming in Python 43


Electronic copy available at: https://ssrn.com/abstract=3953786

You might also like