Difference between revisions of "IB Computer Science 2"

From WLCS
Line 11: Line 11:
 
** Use a pencil!
 
** Use a pencil!
 
* If you wish to turn in any missing work, then you must e-mail me your code for review
 
* If you wish to turn in any missing work, then you must e-mail me your code for review
* Work on Dynamically-sized Stacks
+
* Work on [[Java - Dynamic Stack Assignment]]
** [https://www.cs.usfca.edu/~galles/visualization/StackLL.html Dynamic Stack Visualization]
 
** Load the [https://www.cs.usfca.edu/~galles/visualization/StackLL.html Dynamic Stack Visualization]. Considering the following questions and use the visualization tool to help you answer them.
 
**# What does an empty stack look like? (The top reference variable is null)
 
**# For each of the following actions, assess what the picture looks like Before? then After?
 
**## push(4)
 
**## push(2)
 
**## pop()
 
**## pop()
 
** Create a new class called DynamicStack
 
** What attribute must we keep track of when we talk about stacks? (Hint: rhymes with "mop")
 
** Create a Node reference for the most important stack attribute
 
** Implement '''void push(data)''' using Nodes.
 
*** push() should not return anything
 
*** push() creates a new Node with the data parameter, 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 '''isEmpty()''' which returns true if the stack is empty, and false otherwise
 
** Implement '''print()''' which should print your entire stack from top down (to null)
 
** TEST YOUR STACK
 
*** 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
 
  
 
== Thursday (11/3/16) ==
 
== Thursday (11/3/16) ==

Revision as of 12:01, 10 November 2016

Thursday (11/10/16)

Agenda:

Monday (11/7/16)

Agenda:

  • Node Quiz
    • Closed-note, closed-book
    • Use a pencil!
  • If you wish to turn in any missing work, then you must e-mail me your code for review
  • Work on Java - Dynamic Stack Assignment

Thursday (11/3/16)

Agenda:

Tuesday (11/1/16)

Agenda:

Archives