Announcements, Homework, Lecture Outlines most recent first

Monday, 14-May

 

Final grades with Final Exam and Final Project Scores: 
127BFinalGradesSpring07.htm (if you can't find your CSID, look at the bottom)
Sorted by CSID, which you can get here 

Wednesday, 2-May

Announcements
Answers to Practice Final 
MS-Word  or  PDF
No section this week (this is the last day of class ;-(
Section Leaders will not be covering lab after 4:00 pm today
Final Exam Friday 4-May from 2:00-4:00 in our usual lecture room 
Final Project must be turned in no later than midnight tonight 
Repeating, here are ALL 7 quizzes with ALL answers 
MS-Word or PDF
Here is the practice final handed out during lecture Wednesday
MS-Word  or PDF
There will be two Final Exam Review sessions in 906 Gould Simpson on Thursday, 3-May
2:30-4:30
6:00-8:00

Homework

Take the practice final before the review session you attend or 7:00 pm Thursday

Lecture Outline

Final exam is
Friday @ 2:00pm
Worth 10% of your grade
Use pencil, not a pen please
Have an aisle or one seat between you and your neighbor
Final exam is closed book, closed notes, closed neighbors.  

No calculators or other electronic devices allowed

Final exam is comprehensive. It will have 200 points

Final will use the same Node classes and TreeNode inner classes. See first page of practive final

Final will use the Queue and Stack interface. See first page of practice final

Answers to the practice exercise for the final will be available at the following locations:

o        At the end of the section leader final exam review session

o        At our course web page

o        In the bins outside my office (727 Gould Simpson)

 

Topics:

Classes, objects, sending messages

JUnit tests, know assertions. Will be used to specify or clarify a problem

1-D and 2-D arrays

Implement a data structure with a linked structure, code should match the pictures of memory

Stacks: Use stack methods push, pop, isEmpty, and peek.

Simple recursion: "show the output", write a recursive method.

Binary Trees (exactly two children, where none, one or both may be empty trees).

Tree Traversals (preorder, postorder, inorder)

Recursive tree algorithms  (size, maxHeight, numberOfLeaves, findMax, isBeautiful)

Binary search trees

Big-Oh questions: what is the runtime of an algorithm written in Java. Write the runtimes of operations in different data structures. For example, HashMap put with an array of linked list and no resize is O(1). Use correct notation.

Casting, interfaces, polymorphism through interfaces

Collections, enhanced for loop, NO iterators NO Iterable  

NEW: There will be a bonus question on GUIs and Events 

 

 

Monday, 30-April

Announcements
Section Leaders will not be covering lab after 4:00 pm Wednesday, 2-May
Final Exam will be this Friday from 2-4
To begin review, here are ALL 7 quizzes with ALL answers 
MS-Word or PDF
Final Exam Review session?  Pick times 

Homework

Final Project by Tuesday for full credit, Wednesday for -10
All projects must be turned in no later than midnight of the last day of class

Lecture Outline

HashMap and Tables  (not on final exam)
Section Leader Evals

 

Friday, 27-April

Announcements
None

Homework

Finish Final Project

Lecture Outline

Consider RandomWriterWithHashMap as a preview of today's quiz (there was a handout)
Draw another BST with a Key and a Value
Consider an alternative way to generate a random latter
Quiz 7

 

Wednesday, 25-April

Announcements
Quiz 7 Friday
Java Collections (ArrayList, TreeMap, enhanced for loop, Set, Collection), GUIs, and ActionListener events. 
Boggle Project 2 due next Tuesday, 1-May: Add the GUI
No personal late days may be used on the project
-10 if handed in one day late Wednesday
0/30 if turned in after the last day of class

Homework

Take the Practice Quiz  7: MS-WORD or pdf
Then look at the Answers: MS-WORD or pdf

Lecture Outline

Complete 13JavaCollectionsframwork.ppt
Show two more required GUI components for the Boggle GUI
JOptionPane.showMessageDialog (or use a JTextField in a bigger JFrame)
To AllWordsContainingTheSubstring.java, pop up a model dialog box if the entered text is not found as a substring in any of the words in words.txt
JPanel to store several components that can be treated as one
Add a JLabel to the top
Make 2 JTextFields: One for words that begin with the substring, others that contain it

 

Get together with your team member to complete an in class activity

 

Monday, 23-April

Announcements
Remember, there is a 10pt bonus for turning in the Model by Tuesday night
See Policy in FinalProjectBoggle.pdf

Homework

Work with your partner in pair programming mode on the final project
If possible, work together on all code and tests 

Lecture Outline

Questions on the current project?
Considering some teams are working on the GUI, introduce two more required GUI components (on Wednesday, we'll talk about setColor and javax.swing.Timer for things with which you could add to enhance Boggle, but are not required)
JTextField
JOptionPane.showMessageDialog (or use a JTextField in a bigger JFrame)
Get together with your team member to complete an in class activity

 

Friday, 20-April

Announcements
Final Project grading criteria and late policy now available. There is now a 10pt bonus for the Model
FinalProjectBoggle.pdf

Homework

Work with your partner in pair programming mode
Work together on all code and tests 

Lecture Outline

Begin Java's Collection Framework, slides 1..13
Java List interface and some polymorphic algorithms
See code demos page for example of code that sorts, shuffles, and searches an ArrayList
Questions on the current project?
Get together with your team member to complete an in-class activity

Wednesday,18-April

Announcements
Final Project now linked
For section this week, go to lab in 228 930 GS 

Homework

Begin final project in section
Do not let your partner down, go to section

Lecture Outline

Consider the final project

Friday,13-April

Announcements
Picnic for CS ugrads, PreCS, CS minors Satruday, 12:00-3:00
RSVP here: http://www.cs.arizona.edu/groups/usc/home.html

Homework

Work on OrderedMap

Lecture Outline

Questions on current project?
Picture the remove algorithm for a BST
Quiz 6

 

Wednesday,11-April

Announcements
Quiz 6 Friday: Binary Search Trees and recursive tree algorithms
PracticeQuiz6.doc handed out in class ANSWERS TO BE LINKED HERE THURSDAY @ 5:15 pm  
NEW PracticeQuiz6ANSWERS.pdf   or   PracticeQuiz6ANSWERS.doc 
We will have a 20 minute review session discuss the remove algorithm of project 10 before the quiz
Repeating: The final three sections will be held in the Computer Science Computer Lab: 228GS
12- or 13-April  An Event Driven Program: AnEventDrivenGUI.doc
19- or 20-April  Work with partner on final project
26- or 27-April  Work with partner on final project

Homework

Begin Project 10: OrderedMap
Before Friday's lecture, complete PracticeQuiz6.doc 

Lecture Outline

Introduce OrderedMap project  due next Tuesday
Begin GUIs and Events with GUIsEvents.ppt
Code demos page has SingleButtonFrame.java

Monday, 9-April

Announcements
The final three sections will be held in the Computer Science Computer Lab: 228GS
12- or 13-April  An Event Driven Program
19- or 20-April  Work with partner on final project
26- or 27-April  Work with partner on final project
Tonight: Student Chapter of the ACM Event
Microsoft tech talk Abstract
Monday 9-April 5:30-7:00 pm in 906 GS
Pizza at 5:30, 
Swag 
Drawing for a digital camera (bring your resume to enter the drawing)

Homework

Read about GUIs and Events in Appendix A: "Event Driven Programming with
Graphical User Interfaces (GUIs)"
pages  250-261 

Lecture Outline

The BinarySearchTree<E extends Comparable<E>>
add a toString  method for an inOrder traversal
Show contains (from Friday's in class) both iteratively and recursively
on the code demos page
The Map ADT with a Binary Search Tree data structure, the final solo project
A short presenatation
public class OrderedMap<K extends Comparable<K>, V>
implement boolean put (use the BST algorithm and modify for the mappings)  along with int size()

Friday, 6-April

Announcements
Next Monday: Another Student Chapter of the ACM Event
Microsoft tech talk Abstract
Monday 9-April 5:30-7:00 pm in 906 GS
Pizza at 5:30, 
Swag 
Drawing for a digital camera (need your resume to enter)

Homework

Read about Binary Search Trees in Chapter 11: "Binary Trees"
pages  238..246

Lecture Outline

11B-BinarySearchTrees.ppt
Code Demo: BST insert
In class To BinarySearchTree, add boolean contains()

 

Wednesday, 4-April

Announcements
None

Homework

Work on Project 9: GameTree

Lecture Outline

To GameTree add the following methods
boolean isValidGameTree() return true if every leaf is an answer and every internal node is a question with exactly two children. An empty GameTree is valid.
int height() return the longest path to a leaf (an answer). The height of an empty tree is defined as -1, a tree with one node has a height of 0
In class To GameTree , add printRightLeftTillAnswer()

Monday, 2-April

Announcements
Anyone go to the Lan party? 
Project 9 Posted

Homework

Get GameTree.java and the questions and answers in animal.txt. Verify a tree is built by looking at it sideways

Lecture Outline

Play a game
Consider Project 9: Game of 20 Questions
Implement build and printSideways

Friday, 30-March

Announcements
Lan party this weekend http://www.ualanparty.com/
Quiz 5 today will be given more time than usual, an extra 10 minutes
Programming project 9 will be assigned next week
Enjoy the weekend

Homework

None

Lecture Outline

Questions on recursion?
2:20 Take Quiz (30 minutes rather than 20)
All quizzes will be collected at 2:55

 

Wednesday, 28-March

Announcements
Quiz 5 Friday 30-March will be on Recursion (nothing on trees)
20 Practice Quiz Questions
MS-Word or pdf
Answers will be available here at 9:55 am Friday
Lan Party  this weekend (supposed to be fun, not required)
There is no programming project assigned today
Instead, complete the 20 practice quiz questions on paper before section

Homework

Complete all 20 Recursion Practice Quiz Questions on paper

Lecture Outline

Review for quiz:
Recursion Patterns   (this code is for the first example below)

public class Recursion1 {

  public static void recursive( int num, String one, String two, String three )   {

    if( num <= 0 )

      System.out.println( num + " " + one + " " + two + " " + three );

    else  {

      System.out.println( num + " " + three + " " + two + " " + one );

      recursive( num - 1, two, three, one );

    }

  }

 

  public static void main( String[] args )  {

    recursive( 0, "A", "B", "C" );

    System.out.println( "-------"  );

    recursive( 1, "A", "B", "C" );

  }

}

Printing weird things (Exercises 1 & 4)

Keep a stack of method calls. Write return points and the value of all local variables.  

Example:  see recursive above

Returning values like 2*f(n-1)  (Exercises 2 & 3)

 

 

 

 

 

 

For the recursive case, write the method calls that grow down.   

2*f(n-1)          2*32 = 64

      \           /

    2*f(2)       2*16 = 32

        \       /

       2*f(1)  2*8 = 16

           \  /

            8   

assume if (n==1) return 4  

 

Writing recursive functions given the recursive definitions (Exercises 6, 7, 8, and 9 )

This may be the easiest. Recursive definitions have the base and recursive cases listed. Translate to Java
 
Example:  power(x, n) = x * power(x, n-1);

Writing recursive functions even though they could use a loop. Exercises 10 through 18

Handle the base case(s). Make sure each recursive call increases or decreases an  argument to reach a base case.  Example

Example:  print all evens from start to end

Recursion with arrays Exercises 11-17

You need to go up to length-1 or down to 0 or –1. Let recursion take an index up or down. May need a private helper method to add arguments .

   Example:  find range in an array

Recursion with linked structures (section exercise)

Base case: ref == null.  Let recursion take you to the next node with recCall(ref.next)  
   Example:  toArray for a linked listed of Strings

Recursion with trees.  Not on Friday's quiz

No trees on Quiz 5, 30-March-2007

 

Which practice quiz questions shall we do now?

Monday, 26-March

Announcements
Quiz 5 Friday 30-March will be on Recursion (practice quiz will be handed out Wednesday)
No trees

Homework

Read more about Binary trees in Chapter 11, pages 230..237

Lecture Outline

Begin 11-BinaryTrees.ppt Slides 11.1-11.-15
Implement BinaryTreeOfStrings (from code on slides)
Use an inner class named TreeNode with String data, TreeNode left, and TreeNode right
Add a method to hard code a tree (will build trees more purposefully later) 
trace print
add recursive method size to BinaryTreeOfStrings
In-class (6 minutes) draw a tree, write elements in post order traversal

 

Friday, 23-March

Homework

Read about binary trees in Chapter 11, pages 223..230

Lecture Outline

Demo Obstacle Course GUI
Begin 11-BinaryTrees.ppt Slides 11.1-11.-15
in class: Draw a Binary Tree and visit it inOrder

Wednesday, 21-March

Announcements
None

Homework

Work on Project 8

Lecture Outline

Top 40 Radio RecursionFromNchooseK.ppt
This is the source for 10A: Combinations
Use one more Chapter 10 problem as an example
10H Reverse Array, see page 218 or handout
in class: Two recursion problems

Monday, 19-March

Announcements
Project 8 now linked

Homework

Read about recursion with arrays (Section 10-3) and linked structure (Section 10-3), pages 209.. 214 
Begin Project 8

Lecture Outline

Consider Project 8
A. Add Four recursive methods Methods and test methods to RecursionTest.java
Use other Chapter 10 problems as examples
10D Add Reciprocals, see page 216 or handout
10G Binary Search, see page 218 or handout
10H Reverse Array, see page 218 or handout
10K LinkedOccurencesOf: replace all integers in a singly linked structure with a different integer


Wednesday, 7-March

Announcements
Quiz this Friday: Stack and Queues

Homework

Go to section

Lecture Outline

More recursive algorithms: Fibonacci and Palindrome

Monday, 5-March

Announcements
Quiz this Friday: Stack and Queues

Homework

Read pages 195-207 in Chapter 10: Recursion

Lecture Outline

Questions on the current project?
Discuss the reverse algorithms from Friday's lecture
See answer to reverseStack has been added to  in class reverse elements in a stack
You can modify the object parameter, but assigning that same object parameter a new reference value has no affect on object argument in the call
Take attendance with this algorithm 
 
   if rowNumber is the last row
        return number of students in the last row
    else
        return number of students in your row plus the number of students in the rows behind you
Begin presentation 10-SimpleRecursion.ppt
in-class  recursion

Friday, 2-March

Announcements
Quiz next Friday: Stack and Queues

Homework

Work on project 7: class Expression

Lecture Outline

Queues 09StacksQueues.ppt, slides 9-24..9-46
Consider an array based version SlowQueue.java  (fixed after class)
Write a method that reverses the queue now in SlowQueueTestReverse.java