IB Computer Science II

From WLCS
Revision as of 09:45, 15 October 2009 by Admin (talk | contribs) (Thursday (10/15/09))

Thursday (10/15/09)

Warmup:

  • Demo any missing work
  • Finish adding bubble sort and selection sort to your AddressBook
    • Hint1: You cannot simply compare Contacts, but you can compare their last names
    • Hint2: You cannot sort the ENTIRE Contact array, you can only sort the ones that you have added
    • Hint3: You should test our the sorting methods by adding a (s)ort option to your AddressBookMain

Agenda:

Homework:

  • Stacks quiz on Monday (10/19/09)
  • Dossier - Criteria for Success rough draft due Wednesday (10/21/09)
  • Turn in late assignments! Examples: AddressBook sorting, Problem Analysis, etc.

Tuesday (10/13/09)

Warmup:

  • Please complete this password request form
  • What are the advantages and disadvantages of the binary search algorithm?

Agenda:

  • Dossier peer review - Analysis of the Problem
  • Demo any missing work
  • Sorting & Searching Review
    • Selection Sort
    • Bubble Sort
    • Linear Search
    • Binary Search
  • Examples of using the String.compareTo() method
  • Fix Media:StringBinarySearch.java such that it uses binary search to find a String. Hint: You will be using the compareTo()
  • Demo StringBinarySearch to Mr. Bui by the end of today.
  • You should then add selectionSort() to your AddressBook class. It sorts your AddressBook Contact array by last name using the selection sort algorithm. You may assume that everybody will have a different last name.
  • You should then add bubbleSort() to your AddressBook class. It sorts your AddressBook Contact array by last name using the bubble sort algorithm. You may assume that everybody will have a different last name.
  • Demo the two sorting methods to Mr. Bui before Thursday.
  • Read through Media:CriterionA2_criteriaforSuccess.doc
  • Begin working on your Criteria for Success. It will be due next Wednesday (10/21/09).

Thursday (10/8/09)

Warmup:

  • Given the array of integers: 3, 6, 2, 7, 9, 5, 2, 3
  • Illustrate the bubble sort algorithm to sort the numbers

Agenda:

  • Introduction to Linear Search
  • Download Media:LinearSearch.java
  • Fill in the commented parts of LinearSearch.java and demo a working linear search to Mr. Bui
  • Linear Search performance evaluation
  1. What is the best case scenario? i.e. What is the minimum # of comparisons?
  2. What is the worst case scenario? i.e. What is the maximum # of comparisons?
  3. What is the average # of comparisons?
  4. Can we do better than a linear search?
  • Introduction to Binary Search
  1. Assume sorted list
  2. Go to the middle point
  3. If the middle element matches the key, then the search is over
  4. If the key is less than middle element, go to the left (down), else go to the right (up)
  5. Repeat steps 2-4 until the key is found or when the left and right bounds pass each other
  1. What is the best case scenario? i.e. What is the minimum # of comparisons?
  2. What is the worst case scenario? i.e. What is the maximum # of comparisons?
  3. What is the average # of comparisons?
  • Binary Search Advantages & Disadvantages

Homework:

  • 1st rough draft of Analysis of the Problem due Tuesday (10/13/08)
  • Any missing assignments (e.g. AddressBook, SelectionSort, BubbleSort)

Tuesday (10/6/09)

Warmup:

  • Upload AddressBook.java and AddressBookMain.java to SchoolWebLockers
  • Demo SelectionSort.java to Mr. Bui
  • Turn in your Dossier idea sentence

Agenda:

  • Introduction to Bubble Sort
  1. Initialize the front to be the top or beginning of the array
  2. Now go to the bottom/end of the array
  3. Compare the two adjacent elements to see if they are in proper sequential order
    1. Swap the elements if they are out of order (bigger number to the left of smaller number)
  4. Move to the next pair of adjacent elements/numbers
  5. Repeat steps 3 and 4 until the smallest number has "floated" to the top/front
  6. After you traverse the entire array
    1. Move the front so that the sorted numbers are ignored
    2. Go back to the end of the array
    3. Repeat steps 2 through 6 for the unsorted part of the array
  • Bubble Sort Animation
  • Download Media:BubbleSort.java
    • Fill in the commented parts of the BubbleSort.java file. Where there is a comment, you need to write code.
    • Demo to Mr. Bui at the end of class or at the beginning of class tomorrow
  • Introduction to Program Dossier

Friday (10/2/09)

Warmup:

  • Swapping elements warmup

Agenda:

Homework:

Wednesday (9/30/09)

  1. Find the smallest element
  2. Move to the front of the array (swap with front)
  3. Repeat Steps 1&2, but ignoring the sorted front

Back to School Night

Monday (9/28/09)

Warmup:

  • Create a Java program called ArrayWarmup
  • Declare and initialize an int array of 10 numbers (I don't care what)
  • Write a for loop that traverses the array and prints all the numbers out

Agenda:

Thursday (9/24/09)

Homework:

Tuesday (9/22/09)

  • College Presentation with Ms. Settlemyer

Friday (9/18/09)

Warmup:

  • Demo your Person and Car classes to Mr. Bui

Agenda:

Homework:

Wednesday (9/16/09)

Warmup:

  • Complete the Circle class with the following methods:
    • Circle()
    • getRadius()
    • setRadius()
    • getDiameter()
    • getArea()

Agenda:

Homework:

Monday (9/14/09)

Warmup:

  • Be sure that you have completed the Hello, world Java programs from last week

AddressBookMenu Warmup

  • You will be creating a user interface menu for use with your AddressBook
  • Open / create your AddressBook's main method
  • Print out a message that explains the program (e.g. "Welcome to YOUR_NAME's address book!")
  • Print out a menu with the following options:
(a)dd to address book
(p)rint address book
(q)uit

What would you like to do? 
  • You should prompt for input after the menu is printed. Review Media:JavaIOExample.java for examples of input/output
  • If the user inputs 'a', then print a message that says "USER SELECTED ADD"
  • If the user inputs 'p', then print a message that says "USER SELECTED PRINT"
  • If the user inputs 'q', then print a message that says "USER SELECTED QUIT"

Agenda:

Homework:

Thursday (9/10/09)

  1. Write a Hello, world! program ( Hint: Java program template )
    1. Create a new Java program using JEdit or whatever editor you prefer
    2. Use the Java program template as a guide
    3. Insert your code
    4. Compile and execute your code
      1. Open terminal
      2. Navigate to your Java file
      3. javac FILENAME
      4. Execute your code: java PROGRAM_NAME
  2. Write a program that prints Hello, world 20 times (You may login to eimacs to remember how)
  3. Write a program that prints Hello, world infinite times

Tuesday (9/8/09)

  • Introductions
  • IB Computer Science II Syllabus
  • Name cards
  • Lab setup/config
    • Login username is your first initial and lastname (e.g. pbui)
    • Your password is your student ID number
    • Go to System -> Preferences -> About Me -> Change Password

Summer Break