COMP 102: Computers and Computing Lecture 26: Final Exam Review Instructor: Kaleem Siddiqi (siddiqi@cim.mcgill.ca) Class web page: www.cim.mcgill.ca/~siddiqi/102.html
Number Representation and Logic Binary digits (Bits) Number representation using positional notation Number conversion from one base to another ASCII for text Logical variables and logical operations (AND, OR, NOT) Logical expressions and simple word problems Truth tables Digital logic gates: AND, OR, NOT, NAND, NOR, EX-OR 2
Laws of Boolean Algebra Commutativity Laws Distribution Laws DeMorgan s Laws Application of laws to simplify Boolean expressions Disjunction of Conjunction ( sum of products ) form Finite State Machines and word problems Finite State Machine Implementation 3
Computer Programming Definition of a program Data: input and output, and procedures Notion of a variable and variable assignment A loop Types of variables Arithmetic operations Comparison operators 4
Computer Programming A recursive function Two features of a recursive function: calls itself, checks to see if a termination condition is met (the base case), in which case it exits Basic Features of Programming (Scripting) using Scratch Specifically: conditional statements, different types of loops, recursive functions, etc. 5
Machine Language Basic components of a computer The memory hierarchy The CPU Fetch-decode-execute cycle Notion of a machine instruction and what it does Types of machine instructions (transferring data, arithmetic or logical operations, control of flow) What a compiler does: parsing, front end -> IR -> back end -> executable 6
Arrays and Algorithms Numerous examples of loops in Scratch Specifically: a for loop, a while loop Difference between loops and a recursion Arrays: in Scratch we use 1D arrays or Lists, but this concept is easily generalized to 2D arrays or 3D arrays Indexing an array Definition of an algorithm: an ordered set of unambiguous instructions to solve a precisely stated problem, which also terminates The idea that an algorithm may be described, abstractly, using pseudocode An example of an algorithm (Minimum) and the ability to generalize these ideas to other problems (define inputs, intermediate variables, computations, outputs). 7
Sorting Sock matching examples (different algorithms) Comparing these algorithms Examples where sorting is beneficial (sorting lists, sorting web pages, etc.) Bubble Sort and all its details Complexity (number of operatins) and storage requirements of bubble sort Selection sort and its complexity and storage requirements Merge sort and its complexity and storage requirements Classification of complexity: constant, linear, log-linear, quadratic, exponential 8
Searching, Graphs Sequential search and how it works Binary search and how it works Worst-case analysis (number of operations) of these two approaches Assumptions made by binary search (e.g., that the data has been sorted) Examples of abstract search problems (maze, subway system, etc.) Definition of a graph Properties of graphs: a path, the path length, the adjacency matrix Examples of graph problems: shortest path, minimum travel time, etc. Directed graphs, undirected graphs, cycles and trees 9
Graphs 7 Bridges of Konigsberg problem Euler s formulation of this problem as that of finding a cycle that starts and stops at the same node and visits each edge once (a tour). Euler s Theorem An Eulerian path is a path in the graph that visits each edge exactly once. An Eulerian tour is therefore an Eulerian path that starts and stops at the same vertex. Regular graphs, complete graphs, random graphs Rings and Lattices Graph drawing Depth-first search versus Breadth-first search Best-first search 10
Data Compression Lossy compression versus lossless compression An alphabet Codewords Fixed length versus variable length codewords Definition of a prefix code Representation of a prefix code using a binary tree Huffman Coding algorithm Huffman Coding example 11
Data Compression Contd. Sound files, the AIFF format and the basics of differential coding MP3 frequency encoding: a basic idea of how it works Encoding images: lossless (e.g. TIFF) versus lossy (e.g. JPEG) encoding How movies are encoded (e.g. MPEG2) 12
Constraint Satisfaction Problems Common examples of CSPs Map coloring, satisfying a boolean expression, Sudoku puzzle Details of CSPs: variables, values they can take, constraints that must be respected Definition of a solution to a CSP Different types of variables: boolean, finite domain discrete variables, infinite domain discrete variables, continuous variables Different types of constratins: unary, binary, higher-order Preferences (soft constraints) A constraint graph (nodes as variables and arcs to represent the constraints) The detailed steps of a constructive approach, e.g., as applied to map coloring The two heuristics: most constrained variable and least constraining value The iterative approach and its detailed steps. The pentagon problem. 13
Computability An alphabet, a language and a grammar The notion of decidability of a language or a computer science problem The Post Correspondence Problem (PCP) The Halting Problem The idea that the Halting Problem is undecidable and so too is PCP The Syracuse sequence The Syracuse conjecture 14
Computer Vision What is computer vision? Visual illusions and the idea that what you see is an abstraction 3 Problems in Computer Vision: segmentation, face recognition and stereo The ability to formulate these three problems as computational problems and to suggest and develop possible examples to solve them. 15
Two Guest Lectures High level aspects of the mobile robotics lecture and the ability to answer reasonable questions based on computer science concepts discussed in class that apply to this lecture. Details of the geometry of stereo vision The basic principle behind stereo vision and an understanding of how disparity plays a crucial role The formulation of correspondence as a computational problem 16