Difference between revisions of "IB Computer Science 2"

From WLCS
Line 1: Line 1:
== Friday (11/20/15) ==
+
== Friday - Tuesday (11/20/15 - 11/24/15) ==
 
* Demo DynamicQueue
 
* Demo DynamicQueue
 
* Introduction to [http://en.wikipedia.org/wiki/Linked_list#Basic_concepts_and_nomenclature Linked Lists] (walk-through)
 
* Introduction to [http://en.wikipedia.org/wiki/Linked_list#Basic_concepts_and_nomenclature Linked Lists] (walk-through)
Line 22: Line 22:
 
* Testing DynamicStack
 
* Testing DynamicStack
 
* Dynamically-sized Queues - complete by the end of today
 
* Dynamically-sized Queues - complete by the end of today
*# On paper, draw the before-and-after pictures for enqueue()'s 2 scenarios:
+
*# On paper, draw the before-and-after pictures
*## 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
 
 
 
== Monday (11/16/15) ==
 
'''Agenda:'''
 
* Node Quiz!
 
* Dynamically-sized Stacks
 
** [https://www.cs.usfca.edu/~galles/visualization/Algorithms.html 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
 
** [[Media:Node.java]]
 
** [[Media:NodeFun.java]]
 
** [[Media:NodeFunAgain.java]]
 
* '''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
 
** [https://www.cs.usfca.edu/~galles/visualization/Algorithms.html 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
 
** [[Media:Point.java]]
 
** [[Media:ReferencesReview.java]]
 
* Node class
 
** [[Media:Node.java]]
 
** [[Media:NodeFun.java]]
 
** [[Media:NodeFunAgain.java]]
 
* '''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]]
 
 
 
== Thursday (10/29/15) ==
 
'''Warmup:'''
 
* List the typical stack operations
 
* Be able to describe what they do
 
 
 
'''Agenda:'''
 
* Stack review
 
* Complete static-sized Stack class walk-through
 
** Implement a Stack using a static data structure (e.g. array)
 
** Test out our implementation to find weaknesses
 
** Fix the weaknesses in our implementation
 
* Queues - [[Media:Queues.ppt]]
 
* Work on [[Java - Static Queue Assignment]]
 
 
 
== Tuesday - Thursday (10/27/15 - 10/29/15) ==
 
'''Agenda:'''
 
* Introduction to Stacks - [[Media:Stacks.ppt]]
 
** Be able to describe the characteristics of a stack
 
** Be able to explain the operations of a stack
 
** Be able to describe different stack applications
 
** If given a list or an array, be able to explain their use as stacks
 
* [https://www.cs.usfca.edu/~galles/visualization/Algorithms.html Data Structure Visualizations]
 
* Practice Stack Exercises
 
*# Push the following words onto a stack: "Washington-Lee", "Generals", "Computer", "Science".  What will the words be in the order of popping them all.
 
*# Imagine that you are stuck in a dungeon. You are using a stack to keep track of your movements so that you can find your way back to the beginning of the dungeon. Diagram the stack after the following moves: forward, left, left, right, forward, forward, right, forward, left. Using your stack, what would the order of moves be to return back to your starting position?
 
*# Assume you are given a list of numbers that you can only access one at a time in their order.  Describe how you would use stacks to reverse their order
 
* Static-sized Stack class walk-through
 
** Implement a Stack using a static data structure (e.g. array)
 
** Test out our implementation to find weaknesses
 
** Fix the weaknesses in our implementation
 
 
 
== Friday (10/23/15) ==
 
'''Agenda:'''
 
* [http://idtus.com/contest/ IDT Programming Contest (Nov - Mar)]
 
** Come see Mr. Bui or Eric Weiner if interested
 
* [https://projecteuler.net/ Project Euler]
 
** If you finish assignments early, you are encouraged to attempt these problems
 
* [http://rosalind.info/problems/locations/ Project Rosalind]
 
** If you finish assignments early, you are encouraged to attempt these problems
 
* Demo [[Vector class lab assignment]]
 
 
 
== Wednesday (10/21/15) ==
 
'''Agenda:'''
 
* Happy "Back to the Future" Day! (10/21/15)
 
* Demo the following:
 
** [[Person class lab assignment]]
 
** [[Car class lab assignment]]
 
** [[Vector class lab assignment]]
 
 
 
== Monday (10/19/15) ==
 
'''Agenda:'''
 
* Volunteer & job opportunities for juniors or seniors (if interested, come see Mr. Bui):
 
** Ms. Carlson (PTA member)
 
*** Requirement: HTML skills, general I.T. skills
 
*** Paid work on various projects for non-profit clients: voter registration, e-mail broadcasting, fundraising website maintenance, Facebook page maintenance
 
** Mr. Goldstein (school board candidate)
 
*** Requirement: general I.T. skills
 
*** Volunteer work on various I.T. projects: e-mail broadcasting, data entry
 
* [http://computer-science.egr.vcu.edu/events/computer-science-day/ VCU Computer Science Day (open house)]
 
* Demo the following:
 
** [[Person class lab assignment]]
 
** [[Car class lab assignment]]
 
** [[Vector class lab assignment]]
 
 
 
== Thursday (10/15/15) ==
 
'''Agenda:'''
 
* Demo any missing assignments to Mr. Bui
 
* Complete the Point class definition from last class
 
* Define more static methods in PointMain.java:
 
** double distance(Point p1, Point p2) - returns distance between p1 and p2
 
** Point midPoint(Point p1, Point p2) - returns a new Point, which is the midpoint between p1 and p2
 
* Test your new methods in the main().  Demonstrate the tests to Mr. Bui
 
* [[Person class lab assignment]]
 
* [[Car class lab assignment]]
 
* [[Vector class lab assignment]]
 
 
 
== Tuesday (10/13/15) ==
 
'''Agenda:'''
 
* Demo missing assignments
 
* IA Progress Assignment (due tomorrow!) - via [http://classroom.google.com Google Classroom]
 
*# You will upload any/all code or tutorial documentation to justify your progress on the Internal Assessment.
 
*# You must submit at least 3 artifacts demonstrating Internal Assessment progress for full credit.
 
*# You may include screenshots of tutorial completions (e.g. CodeAcademy).
 
*# At the top of each file, annotate the code or screenshot, explaining what it is and how it is a reasonable artifact for your Internal Assessment
 
*# You may upload multiple files. Be sure to include your name in each document.
 
*# LATE submissions will be penalized
 
* Java Functions/Methods Review
 
** [[Media:JavaMethods.pptx]]
 
** Method Definitions
 
** Method Return types
 
** Method Parameters
 
** Method Calls
 
* Java Objects
 
** [[Media:IntroObjects.ppt]]
 
** [[Media:ObjectUsageReview.ppt]]
 
** [[Media:ObjectUsageReview2.ppt]]
 
** [[Media:IntroClasses.ppt]]
 
** [[Media:OOP.pptx‎]]
 
* Point Class assignment walk-through
 
*# You will create two java files: '''Point.java''' and '''PointMain.java'''
 
*#* '''Point.java''' - the Point class definition will be here
 
*#* '''PointMain.java''' - only the main() method will be located here
 
*# Declare and initialize the following '''private''' attributes in the Point class
 
*#* double x = 0.0
 
*#* double y = 0.0
 
*# Define two Point() constructors:
 
*#* default constructor: Point()
 
*#* specific constructor Point(double newX, double newY)
 
*# Define the following '''public''' methods in the Point class
 
*#* double getX() - returns the x-coordinate
 
*#* double getY() - returns the y-coordinate
 
*#* void setX(double newX) - sets the x-coordinate to the new x-coordinate parameter
 
*#* void setY(double newY) - sets the y-coordinate to the new y-coordinate parameter
 
*#* String toString() - returns a String representation of the Point object
 
*# Go to your PointMain.java file to test out your Point class
 
*# In the main method, create several new instances of Point objects
 
*# Print out each of your Point objects
 
*# Define a static method in PointMain.java named '''double slope(Point p1, Point p2)''' - returns the slope between p1 and p2
 
*# Test and print out your slope method when you use it with your instantiated Point objects in the main() method
 
 
 
== Thursday (10/8/15) ==
 
'''Agenda:'''
 
* Demo Two-Dimensional Array Assignment
 
 
 
== Tuesday (10/6/15) ==
 
'''Agenda:'''
 
* Search and sort quiz
 
* Two-Dimensional Array Assignment
 
*# Write a function: '''matrixAdd(a, b)''' that returns a new matrix that is the sum of a and b
 
*#* Be sure to check if the two matrices are the same size (if not, then return '''null''')
 
*# Write a function: '''fliplr(m)''' that returns a new matrix that is the horizontal flip (left to right) of matrix '''m'''
 
*#* [http://www.mathworks.com/help/matlab/ref/fliplr.html MATLAB fliplr() description]
 
*# Write a function: '''flipud(m)''' that returns a new matrix that is the vertical flip (up to down) of matrix '''m'''
 
*#* [http://www.mathworks.com/help/matlab/ref/flipud.html MATLAB flipup() description]
 
*# Extra Credit: Write a function: '''matrixMult(a, b)''' that returns the product of matrix a and b
 
*#* Be sure to check the rules of matrix multiplication
 
*#* Return an '''null''' matrix if their sizes are different
 
* Challenge: Write the function '''det(m)''' which returns the determinant of any matrix m
 
 
 
== Friday (10/2/15) ==
 
'''Warmup:'''
 
* Seniors, please take the [http://goo.gl/forms/HJCeVXyeYs student sociology project survey]
 
 
 
'''Agenda:'''
 
* Demo both selection sort and bubble sort
 
* [[Media:Sorting.pptx]]
 
* Quicksort discussion
 
* Search and sort quiz next Tuesday (10/6/15). Be able to describe the step-by-step algorithm
 
** Linear search
 
** Binary search
 
** Selection sort
 
** Bubble sort
 
* Reference variables overview
 
* Two-Dimensional Arrays and Nested Loops
 
*# Accessing all of the individual elements of a two-dimensional list
 
*# Prompt the user to construct a two-dimensional list
 
*## Prompt for the number of rows
 
*## Prompt for the number of columns
 
*## Prompt the user for each number in the two-dimensional list
 
*# Write the function '''matrixPrint(m)'''
 
* Two-Dimensional Array Assignment
 
*# Write a function: '''matrixAdd(m1, m2)''' that returns a new matrix that is the sum of m1 and m2
 
*#* Be sure to check if the two matrices are the same size (if not, then return '''null''')
 
*# Write a function: '''matrixMult(m1, m2)''' that returns the product of matrix m1 and m2
 
*#* Be sure to check the rules of matrix multiplication
 
*#* Return an '''null''' matrix if their sizes are different
 
 
 
== Archives ==
 
* [[IBCS2 - 1516 - September]]
 

Revision as of 08:30, 24 November 2015

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
    1. On paper, draw the before-and-after pictures