CS62 - Spring 2010 - Lecture 27

  • admin
       - Assignment 11 due Wednesday at 5pm
       - Tomorrow's lab is optional. You can work on assignment 11 and/or I can answer questions about the final.
       - Final exam: Wednesday, May 12 at 9am in Edmunds 114
       - Last TA office hours tonight (i.e. no more TA office hours starting May 5)
       - I have exams during a couple of my scheduled office hours, so I won't have office hours next week, however, I will be here most of the days and you can stop by or make an appointment
       - Will try and post some practice problems
       - Probably won't have assignment 10 graded by lab, but by end of the week

  • make files
       - for more information look at the references on the course web page
       - a command-line tool to help you compile things
       - can save you a lot of time as your C++ programs get more complicated
       - can use for Java, or other compiled languages
       - look at example makefile for assignment 11 (in /common/cs/cs062/assignments/assignment11)
          - '#' is a comment, like //
          - makefile entries are of the form:
          target: prerequisites
             instructions

          (note that you can have multiple instructions and that each instruction is preceded by a tab)

          - on the command-line you type:

          make <target>

          and it will do the following:
             - for each entry in the prerequisites:
                - if a target exists, recurse on that target
                - otherwise, do some default behavior
                   - for many file types, it just checks to make sure they exists e.g. .cpp, .h
             - once all the prerequisites have been checked and run successfully, run the instructions

          - for example:

             make mg

             - jumps to graph_movie.o
                - checks to make sure graph_movie.cpp and graph_examples.h exist
                - g++ -c graph_movie.cpp
             - jumps to graph_operations.o
                - checks to make sure graph_operations.cpp graph_operations.h priorityqueue62.h
                - g++ -c graph_operations.cpp
             - jumps to priorityqueue62.cpp
                - checks ...
                - g++ -c priorityqueye62.cpp
             - finally, after all prerequisites are satisfied:
                g++ -o mg graph_movie.o graph_operations.o priorityqueue62.o
          
          - if we type "make mg" again, make checks to see if any work needs to be done (i.e. if we've updated any files)
             - if not, tell is that mg is up to date
             - if so, will only update the required targets and rebuild
          - look at clean
             - common in Makefiles
             - removes all of the temporary files we may have made
             - allows you to start from scratch by typing "make clean"
          - .PHONY specifies that the "clean" target does not generate a file
          - we can just type "make" without any parameters
          - it runs the first target in the file
             - often a convention is to make the first target a "default" target

  • Why C++
       - C++ is still very common
       - space efficient
       - operator overloading is pretty cool
       - pre-processor
       - accessor vs. mutator method distinction
       - multiple inheritance

  • a look back
       - 4000 lines of notes (~150 pages)
       - 3700 lines of demo code
       - 3800 lines of assignment code
       - >400 pages in the Java book
       - learned C++!
       - look at Bursti project (http://saras.cs.pomona.edu/bursti/)
          - only prerequisite was cs62
          - final project with 13 students working on it:
             - ~40 classes
             - >5000 lines of code
          - a working search engine

  • review
       - general coding
          - commenting
             - JavaDoc
          - coding style
          - constants
          - what is meant by:
             - public/private
             - static
             - final
             - super
          - assert
          - inheritance interfaces
          - equals vs. ==
          - OO programming
             - design and functionality vs. implementation
             - method signature
          - generics

       - general concepts
          - binary search
          - basic graphics in Java
          - iterators
             - Iterator interface
             - Iterable interface

          - operators
             - bitwise operators
             - ternary operator

       - complexity analysis
          -

       - sorting
          - mergesort
             - merge method
          - quicksort
             - partition method
          - insertion sort
          - bubble sort
          - selection sort   

       - data structures
          - Know
             - how they're represented
             - how they're used
             - what they're good at/bad at
             - different implementations
             - run-times
          - arrays and vectors
          - linked lists
             - singly linked
             - circularly linked
             - doubly linked
             - stacks
          - linear structures
             - stacks
             - queues
          - binary trees
             - tree terminology
             - tree traversal
                - bfs
                - dfs
             - binary search trees
             - balanced trees
          - heaps and priority queues
          - hash tables
             - hash functions
             - hashCode()
             - collision resolution by chaining
             - open addressing
             - maps
       - graphs
          - types
          - terminology
          - representation
             - adjacency list
             - adjacency matrix
             - trade-offs
          - algorithms
             - dfs
             - bfs
             - cycles
             - connectedness and connected components
             - shortest paths
       
       - C++
          - programming in C++
          - preprocessor
             - #include
             - #ifndef ...
          - using namespace
          - use of built-in classes
             - vector
             - string
             - list
             - map
          - defining classes
             - header file usage
          - compiling
          - parameter passing
             - call-by value
             - call-by reference
             - call-by constant reference
             - how Java does it
          - memory and memory management
             - stack vs. heap
          - pointers
             - *, &, ->, .
             - usage
          - operator overloading
          - the big three
             - copy constructor
             - operator=
             - destructor
          - initializer lists
          - default parameters