Difference between revisions of "IB Computer Science II"
From WLCS
(→Friday (11/21/08)) |
|||
Line 1: | Line 1: | ||
'''Welcome to the IB Computer Science II Homepage!''' | '''Welcome to the IB Computer Science II Homepage!''' | ||
+ | |||
+ | == Monday (11/24/08) == | ||
+ | '''Warmup:''' | ||
+ | * Which of the trees is invalid? Why? | ||
+ | * Identify the root node in the binary tree on the board | ||
+ | * Identify all the parents and their children in the binary tree on the board | ||
+ | * Identify all the leaves in the binary tree on the board | ||
+ | |||
+ | '''Agenda:''' | ||
+ | * Introduction to Binary Trees | ||
+ | ** [[Media:BinaryTrees.ppt]] | ||
+ | * BTNode class | ||
+ | * BinaryTree class | ||
== Friday (11/21/08) == | == Friday (11/21/08) == |
Revision as of 09:45, 24 November 2008
Welcome to the IB Computer Science II Homepage!
Contents
Monday (11/24/08)
Warmup:
- Which of the trees is invalid? Why?
- Identify the root node in the binary tree on the board
- Identify all the parents and their children in the binary tree on the board
- Identify all the leaves in the binary tree on the board
Agenda:
- Introduction to Binary Trees
- BTNode class
- BinaryTree class
Friday (11/21/08)
- Implement BubbleSort in your CLinkedList
- NOTE: The inner loop of BubbleSort should traverse the list from head down to tail
- Print out your CLinkedList search(find) and sorting (selectionSort() and bubbleSort() methods
- Introduction to Binary Trees
Monday - Thursday (11/17/08 - 11/20/08)
Warmup:
- Create a new Java file named AddressBookMainWarmup with a main method
- In the main method, do the following:
- Create a new instance of AddressBook named myBook
- Using a for loop, create new Contacts named a0, a1, a2, ... , a99, and add them to your AddressBook
- Remove the Contact at index 99
- Remove the Contact at index 0
- Using a for loop, remove the Contacts from indexes 5 through 20
- Print out all the contacts in your AddressBook using the AddressBook print()
Agenda:
- Demo your AddressBook that uses a CLinkedList
- LinkedList Search - Implement inside CLinkedList as: Contact find(String firstName, String lastName)
- Traverses the LinkedList and checks if the Contact at the current ContactNode matches the same first name and last name that you are looking for
- If it finds your Contact, then return the Contact, otherwise, return null
- LinkedList SelectionSort - Implement inside CLinkedList as: void selectionSort()
- Uses the selection sort algorithm to sort the CLinkedList
- Traversing the CLinkedList uses the same algorithm as print() and find()
- You should be comparing the first and last names of the Contact
- When swapping data (minimum swapped with front), you should swap the Contact objects
Friday (11/14/08)
- By the end of today, you should be able to demo an AddressBook that uses a LinkedList
- Be sure to comment out the find(), selectionSort(), and bubbleSort() methods in your AddressBook class
Wednesday (11/12/08)
- Demo your LinkedList class
- 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 array
- Comment out the methods for find(), selectionSort(), and bubbleSort(). We will convert these later
- Be sure to test your AddressBook with LOTS of contacts
Thursday - Friday (11/6/08 - 11/7/08)
- Show Mr. Bui your Queue before-and-after diagrams
- LinkedLists cont'd
- Attributes: head, tail, size
- Constructors: default
- Methods:
- isEmpty() - returns true if the LinkedList is empty, and false otherwise
- void add(int num) - adds a new Node with num at the end of the LinkedList
- int remove(int index) - removes the index-th Node and returns its data
- There are SIX different scenarios when you remove a Node
- void add(int num, int index)
- There are FIVE different scenarios when you add a Node
- DRAW the before-and-after pictures for all FIVE secenarios
- print() - traverses the LinkedList and prints out each Node's data
- Media:LinkedList.java
- LinkedListTestMain - create as a class
Wednesday (11/5/08)
- Print out your DynamicQueue.java -- I will grade them by hand
- Introduction to LinkedLists
- Attributes: head, tail, size
- Constructors: default
- Methods:
- isEmpty() - returns true if the LinkedList is empty, and false otherwise
- void add(int num) - adds a new Node with num at the end of the LinkedList
- int remove(int index) - removes the index-th Node and returns its data
- There are FIVE different scenarios when you remove a Node
- print() - traverses the LinkedList and prints out each Node's data
- Homework: Draw the before-and-after diagrams for the remove() method
Monday (11/3/08)
Warmup:
- On a separate sheep of paper, please answer the following questions:
- In a dynamically-sized queue's isEmpty() method, what are the two different cases or scenarios that you check for?
- In a dynamically-sized queue's add() method, what are the two different cases or scenarios?
- Draw the before and after picture of each of the two scenarios.
- In a dynamically-sized queue's remove() method, what are the two different cases or scenarios?
- Draw the before and after picture of each of the two scenarios.
Agenda:
- Secret ballot - Have you installed and used Java or JCreator on your computer at home?
- Demo DynamicQueues
- Introduction to Linked Lists