IBCS2 - 1011 - October
From WLCS
Contents
Friday (10/29/10)
Warmup:
- Draw the memory diagram after the following code executes:
Node fun = new Node(42);
Node general = new Node (11);
Node a, b, c;
a = general;
b = a;
fun.next = b;
c = fun;
Agenda:
- Node Practice
- Dynamically-sized Stacks
- 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 push(int num) using Nodes.
- push() should not return anything
- push() creates a new Node with the num, and set the new Node's next reference to the top
- Don't forget to update the top to be the new node!
- Implement pop(), which should POP and return the value on top of the stack and update the top
- Implement top(), which should just return the value on top of the stack
- Implement isEmpty() which returns true if the stack is empty
- Implement print() which should print your entire stack
- TEST YOUR STACK USING MR. BUI'S STACK MAIN OR YOUR OWN MAIN METHOD
- Dynamically-sized Queues
- Create a new class called DynamicQueue
- Test out your DynamicQueue using the original QueueMain file
Wednesday (10/27/10)
Warmup:
- What does FIFO stand for?
- When would you want to use a queue? Give an example
- Assume the following queue operations have occurred:
- Add "Nick"
- Add "Scarlet"
- Add "Sheng"
- Remove
- Add "Daniel"
- Remove
- What is left in the queue?
Agenda:
- Object and References Review
- Node class
- Node references practice
- Read through Media:CriterionA3_prototypeSolution.doc
- Begin working on your Prototype Solution. It will be due next Tuesday (10/27/09).
Homework:
- Dossier - Prototype Solution rough draft due Tuesday (11/3/10)
Monday (10/25/10)
Warmup:
- Turn in your Criteria for Success
- Grab a Stacks Quiz, you may start immediately
Agenda:
- Stacks Quiz!
- Criteria for Success peer edit
- Queueueueueues (Queues)
- Fix Media:Queue.java so that it works. You must fill in all the method bodies
Thursday (10/21/10)
Warmup:
- What does LIFO stand for?
- What data structure does LIFO describe?
- What is the one location that you worry about in the structure from #2?
- What are the two actions that you can do in the structure from #2?
- When would you want to use the structure from #2?
Agenda:
- Array Review
- Stack Review
- Queues
- Fix Media:Queue.java so that it works. You must fill in all the method bodies
Homework:
- Criteria for Success due Monday (10/25/10)
- Stacks quiz on Monday (10/25/10)
Tuesday (10/19/10)
Agenda:
- Introduction to Mr. Fowler
- Field trip debrief
- Sorting & Searching Review
- Linear Search
- Binary Search
- Selection Sort
- Bubble Sort
- Missing assignments
- Dossier - Analysis of the Problem
- Media:LinearSearch.java
- Media:BinarySearch.java
- Analyzing the Problem section - peer edits
- Criteria for Success
- Media:CriterionA2_criteriaforSuccess.doc due Monday (10/25/10)
- Introduction to Data Structures
- Stacks
- Media:Stacks.ppt
- Media:Stack.java
- Media:StackMain.java
- Stacks quiz on Monday (10/25/10)
Homework:
- Criteria for Success due Monday (10/25/10)
- Stacks quiz on Monday (10/25/10)
Friday (10/15/20)
- Field trip
Wednesday (10/13/10)
Agenda:
- Field trip slips!
- Friday Field Trip - meet in Cafeteria at 8:10AM
- Demo Media:LinearSearch.java
- Demo Media:BinarySearch.java
- Introduction to Security
- Authentication - Media:Authentication.ppt
Friday (10/8/10)
Warmup:
- Turn in Analyzing the Problem section
- What are the steps necessary in order to use a dictionary?
- Write it out in a text editor.
Agenda:
- Peer edit analyzing the problem
- Review of 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
- What is the best case scenario? i.e. What is the minimum # of comparisons?
- What is the worst case scenario? i.e. What is the maximum # of comparisons?
- What is the average # of comparisons?
- Can we do better than a linear search?
- Introduction to Binary Search
- Assume sorted list
- Go to the middle point
- If the middle element matches the key, then the search is over
- If the key is less than middle element, go to the left (down), else go to the right (up)
- Repeat steps 2-4 until the key is found or when the left and right bounds pass each other
- Binary Search Demo
- Binary Search Demo2
- Media:BinarySearch.java
- Binary Search performance evaluation
- What is the best case scenario? i.e. What is the minimum # of comparisons?
- What is the worst case scenario? i.e. What is the maximum # of comparisons?
- What is the average # of comparisons?
- Binary Search Advantages & Disadvantages
- Use the following Media:IBCS2Roster.txt
- Convert Media:LinearSearch.java and Media:BinarySearch.java so that it searches for a String name
Wednesday (10/6/10)
Warmup:
- Pickup 5 playing cards from Mr. Bui
- Use the BubbleSort algorithm to hand-sort the cards from least to greatest
Agenda:
- Turn in field trip slips.
- Demo all programs. Interims are due today.
- Work on Dossier: Analyzing the Problem
Homework:
- Analyzing the Problem due Friday (10/8/08)Due Friday (10/8/08)
- Any missing assignments
Monday (10/4/10)
Warmup:
- Complete any missing assignments:
- AddressBook class lab assignment
- SelectionSort
Agenda:
- SelectionSort Review
- Introduction to Bubble Sort
- Initialize the front to be the top or beginning of the array
- Now go to the bottom/end of the array
- Compare the two adjacent elements to see if they are in proper sequential order
- Swap the elements if they are out of order (bigger number to the left of smaller number)
- Move to the next pair of adjacent elements/numbers
- Repeat steps 3 and 4 until the smallest number has "floated" to the top/front
- After you traverse the entire array
- Move the front so that the sorted numbers are ignored
- Go back to the end of the array
- Repeat steps 2 through 6 for the unsorted part of the array
- Sorting Animations
- More Sorting Animations
- 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
- Introduction to the Program Dossier
- Media:CriterionA1_problemAnalysis.doc
- Analyzing the Problem due Friday (10/8/08)
- Work on your Analyzing the Problem section
Homework:
- Analyzing the Problem due Friday (10/8/10)