Difference between revisions of "IB Computer Science 2"

From WLCS
 
Line 1: Line 1:
== Monday (10/15/12) ==
+
== [[IBCS2 - Archives]] ==
'''Warmup:'''
 
* Draw the memory diagram for the following code:
 
 
 
<syntaxhighlight lang="Java">
 
Node x = new Node();
 
x.num = 5;
 
Node y = new Node();
 
y.num = 8;
 
y.next = x;
 
x.next = null;
 
</syntaxhighlight>
 
 
 
'''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
 
*** [[Media:Node.java]]
 
*** [[Media:DynamicStack.java]]
 
** What attribute must we keep track of when we talk about stacks?
 
** Create a Node reference for the most important stack attribute
 
** Implement 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 pop(), which should POP and return the value on top of the stack and update the top
 
** Implement top(), which should just return the value on top of the stack
 
** Implement isEmpty() which returns true if the stack is empty
 
** Implement print() which should print your entire stack
 
** TEST YOUR STACK USING MR. BUI'S STACK MAIN OR YOUR OWN MAIN METHOD
 
 
 
== 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
 
** [[Media:Point.java]]
 
** [[Media:ReferencesReview.java]]
 
* Node class
 
** [[Media:Node.java]]
 
** [[Media:NodeFun.java]]
 
** [[Media:NodeFunAgain.java]]
 
* 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)
 
** [[Media:Queues.ppt]]
 
** [[Media:Queue.java]]
 
** [[Media:QueueMain.java]]
 
* 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]]
 
 
 
== Archives ==
 
* [[IBCS2 - 1213 - September]]
 

Latest revision as of 08:28, 13 September 2023