Lecture 5

Lecture 5ΒΆ

In this chapter we explore Python lists and discuss the execution time of some list operations.

We show how Python provides for stacks using lists. We need to know what list operations to use to have stacks with constant time operations for inserting and retrieving items.

We show see how to implement queues. For doing this we need to explain how to define classes in Python.

Finally we show how Python provides for heaps based on lists. We need to understand how to use the operations in the module heapq.

In all of the cases we show one or more applications so that you understand in what cases each of these data structures help.