Feb 2
homework
We'll discuss the homework.
Type typical is_substring method is O(m*n)) where m, n are the string lengths.
For a varying length of the longer string (n), this is O(n).
abstract data types
Next chapter in the textbook
- Stack
- Queue
- List
- implemented as an array (which they don't go into but which I would like to mention)
- implemented as linked (or doubly linked) nodes
Parts that I am not going to emphasize:
- balanced parens
- pre- and post- fix stuff (They seem a bit contrived as examples of using these data structures.)
- dequeue (i.e. double ended queue) - variation on a theme.
These are import conceptually, both in terms of theoretical constructs for describing algorithms and their O() behavior, and practically in terms of implementing programming language constructs.
It's important to understand the notion of a "pointer" (which is a term from the C programming language) and what that looks like in python. This is essentially the difference between the name of something in computer memory - or a reference to that data in memory - and the value stored at that data location. It is these pointers or references which allow us to build linked lists, and later trees and graphs, as data structures.
I'll walk through the textbook's discussion and/or code in class, and continue on Thursday.
We may also look at a bit of C for comparison - we'll see (so to speak).