Difference between revisions of "IBCS2 - 1516 - November"
From WLCS
Line 72: | Line 72: | ||
** Be able to trace code and draw memory diagram | ** Be able to trace code and draw memory diagram | ||
** Be able to write code that creates a given memory diagram | ** Be able to write code that creates a given memory diagram | ||
− | * | + | * Dynamically-sized Stacks |
− | ** [https://www.cs.usfca.edu/~galles/visualization/ | + | ** [https://www.cs.usfca.edu/~galles/visualization/Algorithms.html Data Structure Visualizations] |
** Stack scenarios and Before-&-After pictures | ** Stack scenarios and Before-&-After pictures | ||
− | **# | + | **# What are the possible behaviors of a stack? |
− | **# What does | + | **# What does the picture look like Before? |
− | **# | + | **# What does the picture look like After? |
− | |||
− | |||
− | |||
− | |||
** Create a new class called DynamicStack | ** Create a new class called DynamicStack | ||
− | ** What attribute must we keep track of when we talk about stacks? | + | ** What attribute must we keep track of when we talk about stacks? |
** Create a Node reference for the most important stack attribute | ** Create a Node reference for the most important stack attribute | ||
** Implement '''void push(data)''' using Nodes. | ** Implement '''void push(data)''' using Nodes. | ||
*** push() should not return anything | *** push() should not return anything | ||
− | *** push() creates a new Node with the data | + | *** push() creates a new Node with the data, and set the new Node's next reference to the top |
*** Don't forget to update the top to be the new node! | *** Don't forget to update the top to be the new node! | ||
** Implement '''int pop()''' using Nodes | ** Implement '''int pop()''' using Nodes |
Latest revision as of 20:56, 6 November 2016
Contents
Friday - Tuesday (11/20/15 - 11/24/15)
- Demo DynamicQueue
- Introduction to Linked Lists (walk-through)
- Data Structure Visualizations
- What does a Linked List look like?
- Linked List attributes
- first
- last
- size
- Linked List methods
- adding data (beginning, middle, end)
- deleting data (beginning, middle, end)
- getting data
- modifying data
- searching for data
- clearing all data
- Complete LinkedList assignment posted on Google Classroom
Wednesday (11/18/15)
Agenda:
- Finish DynamicStack walk-through
- Testing DynamicStack
- Dynamically-sized Queues - complete by the end of today
- On paper, draw the before-and-after pictures for enqueue()'s 2 scenarios:
- enqueueing to an empty queue
- enqueueing to a non-empty queue
- Draw the before-and-after pictures for dequeue()'s 3 scenarios:
- dequeueing an empty queue
- dequeueing the very last node
- dequeueing normally when the queue has more than one node
- Write the dynamically-sized queue code
- Use a combination of the StaticQueue and DynamicStack as templates
- i.e. implement all the methods from StaticQueue (except for isFull())
- Be sure to test your DynamicQueue like the DynamicStack
- Use a combination of the StaticQueue and DynamicStack as templates
- On paper, draw the before-and-after pictures for enqueue()'s 2 scenarios:
Monday (11/16/15)
Agenda:
- Node Quiz!
- Dynamically-sized Stacks
- Data Structure Visualizations
- Stack scenarios and Before-&-After pictures
- What are the possible behaviors of a stack?
- 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(data) using Nodes.
- push() should not return anything
- push() creates a new Node with the data, 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/12/15)
Agenda:
- Stacks and Queues Quiz
- IDT Programming Contest meeting today for team registrations
- Dual Enrollment for NVCC CSC201
- Node review
- Node Quiz on Monday (11/16/15)
- Be able to trace code and draw memory diagram
- Be able to write code that creates a given memory diagram
- Dynamically-sized Stacks
- Data Structure Visualizations
- Stack scenarios and Before-&-After pictures
- What are the possible behaviors of a stack?
- 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(data) using Nodes.
- push() should not return anything
- push() creates a new Node with the data, 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
Monday (11/9/15)
Agenda:
- Circular Queue
- Stacks and Queues Quiz - Thursday (11/12/15)
- Object and References Review
- Node class
- Node Quiz on Monday (11/16/15)
- Be able to trace code and draw memory diagram
- Be able to write code that creates a given memory diagram
Monday - Thursday (11/2/15 - 11/5/15)
Warmup:
- List and describe the stack operations (names of methods and what they do)
- List and describe the queue operations (names of methods and what they do)
Agenda:
- Queues - Media:Queues.ppt
- Complete Java - Static Queue Assignment