tutorial06

tutorial06 - CSC2100B 2007 Spring Data Structures Tutorial 6

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
07:03 07:03   1 CSC2100B 2007 Spring Data Structures Tutorial 6 Last updated: 27 Feb, 2007
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
07:03 07:03   2 Assignment 2 Due: 20 March 2007, 5:00 pm Submission method Written part (Q1 and Q2) Assignment box on 10/F. Programming part (Q3) WebCT Bonus coupons: Please attach to the written  part.
Background image of page 2
07:03 07:03   3 Question 1 Write java methods to implement the required functionality . Use  recursion  instead of looping! Sample Question:   Write the Boolean function  max  that returns the  largest element in a List.  Answer: public int max(List l) { ? ? ? ? ? }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
07:03 07:03   4 Question 1 Write java methods to implement the required functionality . Use  recursion  instead of looping! Question:   Write the Boolean function  max  that returns the largest  element in a List.  Answer: public int max(List l) { if (l.isEmpty() ) throw new HeyException(); if (l.tail().isEmpty()) return l.head(); else { int t = max(l.tail()); if (t > l.head())      return t; else      return l.head(); }
Background image of page 4
07:03 07:03   5 List L1=new Cons (3, new Cons(4, EmptyList())); List L2 = new Cons (8, L1.tail()); Question 2 Draw out the resulting lists  (reference page 10 of lecture  notes 8). Determine the output messages (if any).
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
07:03 07:03   6 List L1=new Cons (3, new Cons(4, EmptyList())); List L2 = new Cons (8, L1.tail()); Question 2 Draw out the resulting lists  (reference page 10 of lecture  notes 8). Determine the output messages (if any). 3 4 [] 8 L1 L2
Background image of page 6
  7 Question 3 Part A Part 1.   Write a symbol table implementation class ( SymbolTable_v2.java )    using  double hashing   Table size: 1001 .   You  MUST  use the specified hash functions when  you submit. (But you are encouraged do some  experiment on other hash functions if you have 
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/28/2010 for the course CSC CSC1110 taught by Professor Cjyuan during the Fall '06 term at CUHK.

Page1 / 25

tutorial06 - CSC2100B 2007 Spring Data Structures Tutorial 6

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online