Difference between revisions of "IB Computer Science II"

From WLCS
Line 2: Line 2:
  
 
You may find the old IBCS2 website here: [http://www.paulbui.net/wl/cs2 IBCS2_0708]
 
You may find the old IBCS2 website here: [http://www.paulbui.net/wl/cs2 IBCS2_0708]
 +
 +
== Thursday (11/6/08) ==
 +
* 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 FIVE different scenarios when you remove a Node
 +
*** print() - traverses the LinkedList and prints out each Node's data
 +
* LinkedListTestMain - create as a class
  
 
== Wednesday (11/5/08) ==
 
== Wednesday (11/5/08) ==
Line 14: Line 26:
 
**** There are FIVE different scenarios when you remove a Node
 
**** There are FIVE different scenarios when you remove a Node
 
*** print() - traverses the LinkedList and prints out each Node's data
 
*** 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) ==
 
== Monday (11/3/08) ==

Revision as of 10:47, 6 November 2008

Welcome to the IB Computer Science II Homepage!

You may find the old IBCS2 website here: IBCS2_0708

Thursday (11/6/08)

  • 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 FIVE different scenarios when you remove a Node
      • print() - traverses the LinkedList and prints out each Node's data
  • 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

Archives