CSci 1902 Homework 2 (version 2)
Due: February 18, 2010, 4:00pm (before class)
Purpose
This homework assignment gets you working with Java arrays, loops, and Strings.
Introduction
One of the simplest methods of cryptography involves the selection of a ran
CSci 1902 Homework 6 (Version 2)
Due: April 29, 2010, 4:00pm (before class)
Purpose
In this group homework assignment, you will implement a computer player for FreeCell while:
Familiarizing yourself with trees and dictionaries with a game tree search
Le
CSCI 1902  Fall 2011  Class #5  20110916

*
* Overview *
*
 Last time
 Detailed walkthrough of a Java class
 This time
 Remarks
 Intro to Homework 1 + questions
 Arrays and Loops
 Time to get HW1 partners
 Your feedback
 Coming up

More on trees, binary trees, binary search trees
*
Note that preorder, inorder, and postorder traversal schemes are
"depth first" traversal schemes. Starts at the root and go as far as
possible along each branch before backtracking. I.e., explores
childre
Using Queues for event simulation
 Service scenarios
 For example: how many checkout stations to have open in a store
 The simulation steps through a series of "ticks" (time units).
 Some events may happen at each tick
 A customer may arrive
 We
Announcements
 I will not have office hours Wednesday
 Wednesday before Thanksgiving: optional review session
*
Review of hash tables
 A hash table is an array
(Why an array? Fast access to all elements)
 We store keyvalue pairs in the elements of
CSci 1902 Homework 1
January 27, 2010
In this assignment you will be working with an implementation of Conway's Game of Life. Your
task will be to implement the game's logic and a variation of it. For this assignment you will need
the les available from t
Binary Search Tree
 Code walkthrough
 Deletion
Feedback exercise
*
Implementation of a BST. A generic class.
 Remember: data must be comparable. so what's the *type* of the
nodes?
 Show my code, remind about "bounded wildcards"
 Walkthrough code
TODAY
COMING UP
*
Implementing queues with a "circular array"
 Leave entries where they are
 Let *both* head and tail float
 head now means "next element to return"
 tail now means "next empty spot"
 Therefore, what should the initial values for
AGENDA
 Iterators
 MergeSort sketch, if time
*
Iterators (continued)
 Pass out the Java documentation for Iterator interface
 Remind them of the structure of an Iterator we've seen already
 instance variable
 constructor
 QUESTION: How would you
Finish hash tables
*
Let's look at some performance figures with different load factors
*
Open addressing
 Compute h(key) to get the index
 If hashTable[index] is occupied, "probe" the table for "the next"
unoccupied spot
http:/research.cs.vt.edu/AVr
Topic 7 Heaps
CSci 1902 Data Structures
baylor
University of Minnesota
Binary Tree
Sorted Binary Tree
Left = smaller
50
Right = bigger
25
75
20
10
30
22
27
60
40
55
90
65
80
100
MaxHeap
Parent is bigger
100
No order between
children
90
65
10
80
55
27
75
6
Topic 3 A Brief Reminder of
Computational Complexity
CSci 1902 Data Structures
baylor
University of Minnesota
Siblings: O, ,
O(n) = upper bound
Worst case
(n) = tight bound
Average case (well, sort of)
(n) = lower bound
Best case
There also lower ca
Java Syntax
CSci 1902 Data Structures
baylor
University of Minnesota
Important Syntax Elements
Begin and End code blocks with cfw_ and
End lines of code with ;
if (0 = numberOfRecordsFound)
cfw_
System.out.println("Sorry");
Dont need ; if next line i
Topic 6 Efficient LookUp
of Keyed Data
CSci 1902 Data Structures
baylor
University of Minnesota
Ways of Accessing Data
Linear search
Index
Binary search
2 ways to do this
Sorted array
Second option?
Key
Dictionary
List stores 1 value (call it valu
TODAY
 Another tricky but useful bit of Java syntax
 More on queue implementations
 Quiz
COMING UP
 Solving some problems with stacks and queues
*
Java: more complicated type parameters
Suppose we want to write an array sort routine that will only acc
TODAY
 Complete the Scramble example
 Implementing Dictionary with a list
 Preparing for Quiz 3
 Note: next time it's possible I'll introduce stacks and queues
*
* REVIEW
*
Java Map interface
public interface Map<K,V> cfw_
/ Basic operations
V put(
TODAY
 Finish implementing Dictionary with a list
 Intro to stacks and queues
 Any quiz questions?
*
The Stack ADT
 LIFO order
 useful any time you have work to do in reverse arrival order
 Examples
 cards (some cases)
 software versions
 Prog
CSci 1902 Homework 4
Due: March 25, 2010, 4:00pm (before class)
Purpose
In this individual homework assignment, you will obtain and sort a list of files while:
Practicing the implementation of sorting algorithms
Learning about the uses and benefits of J
CSci 1902 Homework 5 (v2)
Due: April 8th, 2010, 4:00pm (before class)
Purpose
In this group homework assignment, you will implement an arithmetic calculator from scratch. You will
not be given any code to modify or add to. The purpose of this homework is
CSci 1902 Homework 3
Due: March 4th, 2010, 4:00pm (before class)
Goals
Develop a simulation of a population of humans working together and against each
other. Investigate what happens in different types of societies.
Experience
Statistics 3021, Spring 2009: Midterm Exam 2
,xé/C
Name: ._._._._._ Student ID #: L
0 You have 50 minutes to complete this exam. The exam is closed book. You may use a
calculator, and three sheets of paper with formulas or other notes on both sides.
0 Thi
Important Syntax Elements
Begin and End code blocks with cfw_ and
End lines of code with ;
Lecture 02 Java Syntax
CSci 1902 Intro to Stuff
1.28.13
baylor
University of Minnesota
if (0 = numberOfRecordsFound)
cfw_
System.out.println("Sorry");
Dont nee
The rest of the semester
 Finish Heaps
 Maintaining balanced Binary Search Trees
 Social Computing problems
*
Heaps, continued
Array implementation of a binary heap
 Given a binary heap (drawn as a tree), show the numbering scheme
 EXERCISE: Ask
CSCI 1902  Fall 2011  Class #1  20110907

*
* Welcome to CS 1902! *
*
 General goal for the semester: for *everyone* to learn, everyone
to succeed
 Course staff
 Instructor: Loren Terveen
 Grad School  Univ. of Texas Austin
 11 years at
CSCI 1902  Fall 2011  Class #3  20110912

*
* Overview *
*
 Last time
 Fundamentals of imperative and objectoriented programming
 Variables, types, statements
 Structure of a Java class
 This time
 Announcements
 Into to control structu