Difference between revisions of "IB Computer Science 2"

From WLCS
 
Line 1: Line 1:
== Thursday (11/18/10) ==
+
== [[IBCS2 - Archives]] ==
'''Warmup:'''
 
* Look at the board, identify the invalid node in each binary tree.  Where should the invalid node go in order for the tree to be valid?
 
 
 
'''Agenda:'''
 
* Review setters/getters
 
* Review using methods of objects
 
* Complete and demo a working AddressBook that uses LinkedList
 
* How do we add sorting to our AddressBook?
 
* Binary Trees!
 
 
 
== Tuesday (11/16/10) ==
 
'''Warmup:'''
 
# Create a new class named ContactNode
 
# It should have two attributes:
 
#* Contact c = null
 
#* ContactNode next = null;
 
# It should have two constructors
 
#* Default constructor: ContactNode()
 
#* Specific constructor: ContactNode(Contact newC)
 
# You should make setters and getters for the attributes
 
 
 
'''Agenda:'''
 
* Create a new class called ContactLinkedList
 
* Convert your LinkedList to use ContactNode and call it ContactLinkedList
 
* Be sure to test your ContactLinkedList
 
* AddressBook class review
 
* Convert your AddressBook to use ContactLinkedList instead of Contact[] array
 
** Be sure to test your AddressBook with LOTS of contacts
 
** HINT: Use a loop to auto-create 100s of Contacts and auto-add them
 
* Introduction to Binary Trees
 
** [[Media:BinaryTrees.ppt]]
 
 
 
== Friday (11/12/10) ==
 
'''Agenda:'''
 
* Demo your completed LinkedList
 
* Contact class review
 
* Create a new class from your Node class and called ContactNode
 
* Create a new class called ContactLinkedList
 
* Convert your LinkedList to use ContactNode and call it ContactLinkedList
 
* Be sure to test your ContactLinkedList
 
* AddressBook class review
 
* Convert your AddressBook to use ContactLinkedList instead of Contact[] array
 
** Be sure to test your AddressBook with LOTS of contacts
 
** HINT: Use a loop to auto-create 100s of Contacts and auto-add them
 
 
 
== Friday - Tuesday (11/5/10 - 11/9/10) ==
 
'''Agenda:'''
 
* Demo [[Media:DynamicStack.java]]
 
* Demo [[Media:DynamicQueue.java]]
 
* Introduction to Linked Lists
 
** [[Media:LinkedList.java]]
 
** Attributes: head, tail, size
 
** Constructors: default
 
** Methods:
 
*** boolean isEmpty() - returns true if the LinkedList is empty, and false otherwise
 
*** void append(int num) - adds a new Node with num at the end of the LinkedList
 
*** void add(int num, int index) - adds a new Node with num at the index specified
 
**** There are FIVE different scenarios when you add a Node
 
**** DRAW the before-and-after pictures for all FIVE secenarios
 
*** int remove(int index) - removes the index-th Node and returns its data
 
**** There are SIX different scenarios when you remove a Node
 
*** int getNum(int index) - returns the num found at the index (HINT: you'll need to traverse the LinkedList)
 
*** int search(int num) - returns the index of the Node with num (returns -1 if num not in list)
 
*** void print() - traverses the LinkedList and prints out each Node's data
 
* Test your LinkedList using [[Media:LinkedListTestMain.java]]
 
 
 
== Wednesday (11/3/10) ==
 
'''Warmup:'''
 
* Draw the memory diagram after the following code executes:
 
<source lang="Java">
 
Node head = new Node(14);
 
Node tail = head;
 
tail.next = new Node(15);
 
tail = tail.next;
 
head.next.next = new Node(926);
 
tail = tail.next;
 
tail.next = new Node(3);
 
tail = tail.next;
 
</source>
 
 
 
'''Agenda:'''
 
* Turn in your Prototype Solutions
 
* Return all papers
 
* Demo your [[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]]
 
 
 
== Tuesday (11/2/10) ==
 
* Teacher Work Day
 
 
 
== Archives ==
 
* [[IBCS2 - 1011 - October]]
 
* [[IBCS2 - 1011 - September]]
 

Latest revision as of 08:28, 13 September 2023