Difference between revisions of "IB Computer Science 2"
From WLCS
Line 1: | Line 1: | ||
+ | == Friday (11/2/12) == | ||
+ | '''Agenda:''' | ||
+ | * AddressBookLL Assignment | ||
+ | *# Create a new Java Project and name it AddressBookLLProject | ||
+ | *# Copy over your Contact, AddressBook, and AddressBookMain classes to this new project | ||
+ | *# Create a new class named ContactNode | ||
+ | *#* ContactNode should be just like Node, but instead of having an '''int num''', you should have a '''Contact contact''' as the internal attribute | ||
+ | *#* Also be sure to have the next reference, which should be of type: ContactNode | ||
+ | *#* Your ContactNode class should have two constructors: ContactNode() and ContactNode(Contact newContact) | ||
+ | *# Create a new class named ContactLinkedList | ||
+ | *#* Copy over your LinkedList code | ||
+ | *#* Convert the code so that it uses ContactNode and Contact instead of int | ||
+ | *#* Wherever you need to return an error Contact, return '''null''' or -1 | ||
+ | *# Change AddressBook so that it uses the ContactLinkedList instead of the Contact[] | ||
+ | *#* Be sure to create a '''new''' instance of ContactLinkedList in the AddressBook() constructor | ||
+ | *#* Most of AddressBook will look MUCH simpler b/c all you need to do is use the ContactLinkedList | ||
+ | *#* Comment out your sort() method | ||
+ | *# Test out everything using AddressBookMain, which should not require any changes except for commenting out the sort option | ||
+ | * When you are done with AddressBookLL, edit the sort option so that it works with a LinkedList of Contacts | ||
+ | |||
== Wednesday (10/31/12) == | == Wednesday (10/31/12) == | ||
* Missing Linked List Demos | * Missing Linked List Demos |
Revision as of 11:19, 2 November 2012
Contents
Friday (11/2/12)
Agenda:
- AddressBookLL Assignment
- Create a new Java Project and name it AddressBookLLProject
- Copy over your Contact, AddressBook, and AddressBookMain classes to this new project
- Create a new class named ContactNode
- ContactNode should be just like Node, but instead of having an int num, you should have a Contact contact as the internal attribute
- Also be sure to have the next reference, which should be of type: ContactNode
- Your ContactNode class should have two constructors: ContactNode() and ContactNode(Contact newContact)
- Create a new class named ContactLinkedList
- Copy over your LinkedList code
- Convert the code so that it uses ContactNode and Contact instead of int
- Wherever you need to return an error Contact, return null or -1
- Change AddressBook so that it uses the ContactLinkedList instead of the Contact[]
- Be sure to create a new instance of ContactLinkedList in the AddressBook() constructor
- Most of AddressBook will look MUCH simpler b/c all you need to do is use the ContactLinkedList
- Comment out your sort() method
- Test out everything using AddressBookMain, which should not require any changes except for commenting out the sort option
- When you are done with AddressBookLL, edit the sort option so that it works with a LinkedList of Contacts
Wednesday (10/31/12)
- Missing Linked List Demos
- Criteria for Success due Friday (11/2/12)
- Complete it today! Use Google Docs! Be sure to go through the outline and rubric!
Monday (10/29/12)
- Hurricane Sandy
Thursday (10/25/12)
- No 1st Quarter Exam, but we'll have a comprehensive exam in November
- Criteria for Success due Friday (11/2/12)
- How many specific problems did you mention in your A1: Problem Analysis? (should have at least 5)
- Problem -> Goal Table (Open up a Google Doc and create a table with 2 columns)
- Media:CriterionA2_criteriaforSuccess.doc due Friday (11/2/12)
- Demo Linked List to Mr. Bui using Media:LinkedListTestMain.java
Tuesday (10/23/12)
- Complete Media:LinkedList.java
- Create your own main that tests out each of the Linked Lists's methods
Friday (10/19/12)
Warmup:
- Node References Quiz 2
Agenda:
- IDT Programming Contest
- Design contest - given a problem scenario, create the solution
- Teams of 2-3 people
- Runs from early December to mid February
- Prizes for students and schools
- Complete and demo Media:DynamicQueue.java
- Introduction to Linked List
- Linked List JavaDoc
- Download and complete Media:LinkedList.java
- Attributes: first, last, size
- Constructors: default
- Methods: listed in the file above
- Create your own main that tests out each of the Linked Lists's methods
Wednesday (10/17/12)
Warmup:
- Draw the memory diagram for the following code:
Node top = null;
top = new Node(20);
Node bottom = top;
top.next = new Node(12);
bottom = bottom.next;
bottom.next = new Node(13);
bottom.next.next = null;
Agenda:
- Demo Media:DynamicStack.java
- Review Dynamic Queue
- Memory diagrams for each method
- Begin/Starting scenarios for each method
- Draw the before-and-after pictures for adding a Node to an empty Queue (be sure to use head and tail!)
- Draw the before and after pictures for adding a Node to a non-empty Queue
- Draw the before-and-after pictures for removing a Node from an empty Queue
- Draw the before and after pictures for removing a Node from a non-empty Queue
- Complete and demo Media:DynamicQueue.java
Homework:
- Node References Quiz 2 on Friday (10/19/12)
- Complete and demo Media:DynamicQueue.java
Monday (10/15/12)
Warmup:
- Draw the memory diagram for the following code:
Node x = new Node();
x.num = 5;
Node y = new Node();
y.num = 8;
y.next = x;
x.next = null;
Agenda:
- Node references practice
- Pair up
- Each person should type up an example main that uses Nodes
- Each person should then draw the memory diagram of the other person's code
- Repeat!
- Everybody must be an expert using Nodes and references
- Node Quiz
- Static vs. Dynamic
- Dynamically-sized Stacks
- Stack scenarios and Before-&-After pictures
- What are the possible scenarios?
- What does the picture look like Before?
- What does the picture look like After?
- Create a new class called DynamicStack
- What attribute must we keep track of when we talk about stacks?
- Create a Node reference for the most important stack attribute
- Implement void push(int num) using Nodes.
- push() should not return anything
- push() creates a new Node with the num, and set the new Node's next reference to the top
- Don't forget to update the top to be the new node!
- Implement int pop() using Nodes
- pop() removes the value on top of the stack, return it
- pop() should also update the top
- pop() returns null if the stack is empty
- Implement top(), which should just return the value on top of the stack
- If the stack is empty, then return some error code
- Implement isEmpty() which returns true if the stack is empty, and false otherwise
- Implement print() which should print your entire stack
- TEST YOUR STACK USING MR. BUI'S ORIGINAL STACK MAIN OR YOUR OWN MAIN METHOD
- Be sure to push A LOT of data to test the dynamic size
- Also test popping A LOT of data to make sure it works too
- Stack scenarios and Before-&-After pictures
Thursday (10/11/12)
- What does FIFO stand for?
- When would you want to use a queue? Give an example
- Assume the following queue operations have occurred:
- Add "Hyde"
- Add "Bradfield"
- Add "Infantino"
- Remove
- Add "Silverman"
- Remove
- What is left in the queue?
Agenda:
- Demo your completed CircularQueue Assignment
- Object and References Review
- Node class
- Node Quiz on Monday (10/15/12)
- Be able to trace code and draw memory diagram
- Be able to write code that creates a given memory diagram
Homework:
- Node Quiz on Monday (10/15/12)
Tuesday (10/9/12)
Agenda:
- Stacks Quiz 2
- Demo your completed Media:Queue.java using Media:QueueMain.java
- CircularQueue Assignment
Thursday (10/4/12)
Agenda:
- Turn in Criterion A: Analyzing the Problem
- Stacks Review
- Stacks Pop Quiz
- Stacks Quiz 2 on Tuesday (10/9/12)
- Queueueueueues (Queues)
- Fix Media:Queue.java so that it works. You must fill in all the method bodies
Homework:
- Stacks Quiz 2 on Tuesday (10/9/12)
- Fix Media:Queue.java so that it works with Media:QueueMain.java