COMP 250 - winter 2007

Assignments

handed out due date additional files
Assignment 1 a1.pdf January 8 January 17 Card.java, Deck.java, Player.java, PokerTable.java
Assignment 2 a2.pdf January 19 January 31
Assignment 3 a3.pdf February 5 February 14 Stack.java, Queue.java, Helper.java, Node.java, Customer.java, EmptyStackException.java
Assignment 4 a4.pdf February 26 March 7 BST.java, BinTreeNode.java, Node.java, Queue.java, EmptyStackException.java
Assignment 5 a5.pdf March 9 March 21
Assignment 6 a6.pdf March 24 April 11 HashFunction.java, Dictionary.java, DictionaryItem.java, Student.java, Example.java
If you have concerns about the marking of an assignment and you would like to speak with a marker directly, simply check this list and attend an office hour chaired by one of the markers of the assignment in question.

Corrections, Clarifications, and Hints

  • Assignment 6
    • In file Dictionary.java, the second parameter to the constructor should be newMaxKeyValue. This has been corrected in the file. I modified file Example.java such that the call to the constructor has two parameters and I added a variable keyRange to be passed in as the second parameter.
  • Assignment 4
    • Methods minKey and maxKey should return -1 if the tree is empty.
    • I corrected a typo in file BST.java: "inoder" now reads "inorder".
    • Question 3 should refer to method delete rather than method remove.
    • In question 9, method inorderRecordAux doesn't actually return a queue. The queue is passed as a parameter and code inside method inorderRecordAux can then add elements to the queue.
  • Assignment 3
    • There are actually six .java files to download (and not four as I wrote on the assignment handout). You only need to submit Helper.java, Stack.java, Queue.java, and your README file.
    • I have corrected the signature to the second constructor in the class Queue. The correct signature is public Queue(Node<E> firstNode).
    • I added a few more <E>'s to the files Stack.java and Queue.java. <E> is a generic type. You can find out more about generic types here or in section 2.5 of the textbook.
  • Assignment 2
    • In section 1, question 3, the second line of the code is correct but could also be written as:
      max = (1<<i) + 2*i;
      Note the brackets! The difference is that the previous version of the code does not work for i=0 (note that i >= 1 in the code).
    • In section 2, the variable size should instead be bits. This error occurs multiple times.
    • In section 2, questions 1e and 1g, you may write a recursive helper method such that the method maxRecur (or maxRecur4) is a wrapper that calls the recursive method with the proper initial parameters.
  • Assignment 1
    • The tournament consists of two rounds of play. In question 7, part g, of assignment 1, the second round consists of one single game whose winner determines the overall champion. In particular, the number of players at the table in this championship game is exactly numTables. In the first round, each table seats at most playersPerTable players; this is not the case for the championship round.
    • Question 4 does not specify how a player should bet if he or she does not have a pair of aces nor a face card but does have a pair of cards of rank lower than ace. In this case you may set the bet amount as you wish (between 0 and the total amount of money available to the player). Note also that MIN_BET (and 2 * MIN_BET) may exceed a player's available money, in which case a losing bet may result in the player having a negative amount of money; this is permitted (if this occurs, the player stops playing after this hand).
    • Question 7 a) asks you to add an instance variable called numPlayers to the class Tournament. Note that two different classes can have instance variables of the same name (Tournament and PokerTable in this case). I mention this to emphasize that these are different variables, storing different values.
    • The file PokerTable.java contained a small typo on line 167. The index of array players should be j instead of i. I have modified the file accordingly. The corrected line now reads:
      line 167 if (players[j] != null && players[j].isPlaying() &&