Topics: Sort: bogo, bubble, selection, merge sort Linear search vs. Binary search on a sorted list. Going through examples.
Graphs Module Many forms of information naturally organize themselves into trees of various kinds. But what about transit maps, wiring diagrams, the world wide web or even secret underground passages. Most of these have one or two key properties that make them be graphs instead of trees. One property is …
Topics: Complexity: measuring efficiency, timing programs, counting operations Efficiency is important. Separate time and space efficiency of a program Tradeoff between them: can use a bit more memory to store values for quicker lookup later Think fibonacci recursive vs. fibonacci with memoization Challenges in understanding efficiency A program can be …
Topics: Complexity: Big-Oh notation, Big-Theta notation, complexity relations and classes, calc-complexity Getting introduced to the python time.perf_counter() function. This is new to me. I guess its a more accurate version of time.time(). We compare the runtime of a few different functions. The plots of input size vs. runtime …
Finished the problem set in about 2.6 hours. It was a good exercise. Github link to my solution: https://github.com/miguelHx/intro-to-cs-mit-problem-sets/tree/main/1_ps4
Topics: Inheritance: more examples Reinforcing same concept as previous lectures but with a more involved example. I learned something new. You can get the class state by doing something like this: SimpleWorkout.__dict__.keys() You can do the same on an instance variable. Most of this was review for me …
Problem 1: I have an idea of how to solve this problem. I just need to prove that no matter what step we take from (m, n), except when m = 0 and n = 0, m and n will never be equal to each other. I could look up an example …
Topics: Inheritance: hierarchies, subclasses, using inherited methods, examples We start with reviewing the basics of a class and objects. Getter and setter methods. Data attributes, code style, some examples. Going over hierarchies and implementing in code, which is just using sub-classes. Overriding parent methods. Class variables are shared between all …
Accumulators Module The rules we have been using to generate structural recursion templates are very powerful. They make it very easy to write functions that traverse complex data collecting information at every place in that data. The power of these rules is highlighted by our ability to design abstract fold …
Topics: Object Oriented Programming: dunder methods, examples We start with a review of classes and methods from last lecture. Class vs. instance of a class. All review for me, of course, but I like to observe how they teach it. Dunder methods review. Why OOP and bundling the data in …