.. _module3: ************************************************************************************************************ Module 3 | Arborescent data structures, Object Oriented Programming (inheritance, polymorphism, delegation) ************************************************************************************************************ Objective ========= By the end of this module, students will be able to: * Use and implement arborescent and recursive data structures (trees, lists, ...) * Understand and implement traversal algorithms over trees and lists (prefix, infix, suffix) * Be able to analyze the time complexity of algorithms over arborescent data-structures * Understand serialization of arborescent data structures Resources ======================================= Slides (keynote) * `Lecture 3a Arborescent and Recursive ADT Slides `_ * `Lecture 3a Arborescent and Recursive ADT videos `_ * `Youtube Live 2020 `__ Q&A Session * `Object Oriented Programming Concepts Slides `_ * `Object Oriented Programming Concepts video `_ * `Youtube Live 2020 `__ Q&A Session Files used in the slides: * RecursiveList.java :download:`java ` * RecursiveTree.java :download:`java ` * BinaryExpressionTree.java :download:`java ` Exercises: week 1 ======================================= 1. `Equality test between trees `_ 2. `Inorder traversals `_ 3. `Combining two trees `_ 4. `MCQ on time complexities `_ Restructuration 2021 -------------------- * :download:`Slides <./2021-10-21-Restructuration.pdf>` * Source code of tree comparison: :download:`Node.java <./part1_code/exercise1/Node.java>` and :download:`Tree.java <./part1_code/exercise1/Tree.java>` * Source code of in-order traversal: :download:`Traversal.java <./part1_code/exercise2/Traversal.java>` * Source code of `decision trees `_: :download:`DecisionTree.java <./part1_code/exercise3/DecisionTree.java>` Exercises: week 2 ======================================= 1. `Comparator vs Comparable `_ 2. `Inheritance : Fill the gaps (Small Exercise) `_ 3. `Abstract class `_ Restructuration 2021 -------------------- * :download:`Slides <./2021-10-28-Restructuration.pdf>` * `Youtube Live `__ * Source code of the `physics solver `_: :download:`PhysicsSolver.java ` Design exercise ---------------- Implement this interface with three different classes `Circle, Square, Triangle`. .. code-block:: java public interface Shape { public void draw(); public void erase(); } * Each method should print something to the console like "drawing a circle". * Now implement one class RandomShape that randomly draw a circle, a square or a triangle by flipping a coin. * What are the OOP principles that you are using here ? * Can your design easily be used to also include rectangles in the RandomShape ?