Discussion 1B: F 4:00-6:00pm in BH 5264 CS 32 – Spring 2008 – UCLA
Office Hours: M 12:30-1:30pm, W 11:30-12:30pm in BH 4428 chuong [at] cs [dot] ucla [dot] edu

News | Projects & HW | Discussions | Related Materials

PROJECTS & HOMEWORK

Project 2

  • void interleave(const Sequence& seq1, const Sequence& seq2, Sequence& result);
    • result will always be modified to contain the resulting sequence
    • we promise not to modify the sequence seq1 refering to through the use of the parameter seq1
    • we can, however, modify the sequence result refering to through the use of the parameter result, even if it refers to the same sequence as seq1 does (hey, I didn’t alter seq1 as I promised in the interface)

Homework 1

  • For part1-4 you have to use normal (static) array to implement the Sequence class, with the capacity of DEFAULT_MAX_ITEMS. In part5, you’re required to use dynamically allocated array instead (use the “new” operator to allocate dynamic array)
  • int remove(const std::string& value);
    // Erase all items from the sequence that == value. Return the
    // number of items removed (which will be 0 if no item == value)

    • the spec uses the word “erase”, there is an “erase” function in the Sequence class, is that a hint?
  • You’re not allowed to modify the public interface of either the Sequence or ScoreList class. You can do whatever you want with the private section of those classes, however. That means you can have private data members and private functions (helper functions) if you like.

Project 1

  • header file (.h file): should contain other .h files that it references to (if Arena.h file talks about Player class, it better do #include “Player.h”).
    • note that if A.h includes B.h and B.h also includes A.h, we should be using
      • inside A.h: class B; instead of #include “B.h”
      • inside B.h: class A; instead of #inlcude “A.h”
  • implementation file (.ccp file): should contain other .h files that it references to (if Player.cpp talks about Robot class, it better do #include “Robot.h”)