Csci 210 Lab 5 & 6: Boggle
(Laura Toma adapted from Eric Chown)
Overview
In this assignment, you will implement the back-end logic for a graphical version of the popular
board game Boggle. Specifically, you will design and implement the algorithmes necess
Homework 3
Due October 15th
Check out the java skeleton for drawing the Sierpinski triangles on the class
website. Fill in the details of method sdraw.
public void sdraw(Point p1, Point p2, Point p3) cfw_
System.out.println("drawing:" + p1 + p2 + p3);
/te
Final Review
1.
REVIEW TOPICS
Java basics
Sorting and searching
linear and binary search
bubble sort, insertion sort, selection sort
Linked lists
lists vs. arrays
operations on lists and analysis
singly LL, doubly LL, circular lists
Program analysis
growt
Computer Science 210:
Data Structures
Linked lists
Arrays vs. Linked Lists
Weve seen arrays:
int[] a = new int[10];
a is a chunk of memory of size 10 x sizeof(int)
a has a xed size
a[0] a[1] a[2] .
a[9]
A linked list is fundamentally different way of
Csci 210 Lab: Terrains
(Laura Toma)
Overview
Test grids:
brunsdem.asc
kaweah.asc
sierra.asc
test1.asc
test2.asc
srtm_21_05.asc
srtm_22_04.asc
Vast amounts of terrain data is available from remote sensing technology. Most data available is
in the form of a
csci 210: Data Structures
Recursion
Summary
Topics
recursion overview
simple examples
Sierpinski gasket
counting blobs in a grid
Hanoi towers
Recursion
A method of defining a function in terms of its own definition
Example: the Fibonacci numbers
f (n)
Computer Science 210:
Data Structures
Fall 2010
Welcome to Data Structures!
The class is about designing, analyzing, implementing and using fundamental data
structures in solving problems.
Prerequisites:
csci 101 (at Bowdoin or in high-school)
In othe
Csci 210 Lab 1: Dot puzzles
(Laura Toma adapted from Eric Chown adapted from Northeastern University.)
Overview
In this laboratory, you will draw a series of 16 dot patterns using nested for loops. You may
think of the dot patterns as geometric puzzles to
Gnomes
(1) Write a method in class Gnome that sets the buddy of a gnome to the gnome
specied as parameter.
public void setBuddy (Gnome g)
(2) How does a gnome look like after the following:
Gnome g;
(3) How does a gnome look like after the following:
Gnom
Computer Science 210:
Data Structures
Object Oriented (OO) concepts
Summary
Today
object-oriented design principles
OO concepts
inheritance
polymorphism
this
exceptions
interfaces
Inheritance
Inheritance is the capability of a class to use the propertie
Computer Science 210:
Data Structures
Arrays
Collections of data
The most common thing you want to do when writing algorithms/code is handle a
bunch of data.
How?
Arrays
Linked lists
Arrays
int[] a;
/declare a to be an array; a is null
a = new int[10]
Homework 2
Due Wed September 23th
(1) Suppose you are comparing implementations of insertion sort and selection sort
on the same machine. For inputs of size n, insertion sort runs in 8n2 + 20n
instructions, while selection sort runs in 10n2 . For which va
Homework 4
Due Tuesday October 27th before class time
It is possible to implement queues using an array such that both enqueues and
dequeues take O(1) time, in the case when we know the maximum size of the queue
at construction. Write the Java code for th
Computer Science 210:
Data Structures
Searching
Searching
Given a sequence of elements, and a target element, nd whether the target
occurs in the sequence
Variations:
nd rst occurence; nd all occurences
nd the number of occurences, etc
Searching is a f
Csci 210 Lab: Sudoku
(Laura Toma adapted from Eric Chown)
Overview
In this lab we are going to use search to solve the game Sudoku. In Sudoku the goal is to
complete a grid of numbers. When finished each row and column must include all of the
numbers 1 to
Csci 210: Tetris I
(Laura Toma adapted from Eric Chown based on a lab developed at Stanford by Nick Parlante)
Overview
In this lab you will start developing a Tetris game. The design will emphasize elemental Object
Oriented Programming (OOP) design - usin
Csci 210 Lab 1: Dot puzzles
(Laura Toma adapted from Eric Chown adapted from Northeastern University.)
Overview
In this laboratory, you will draw a series of 16 dot patterns using nested for loops. You may
think of the dot patterns as geometric puzzles to
Csci 210 Lab: Vizualizing Terrains
(Laura Toma)
Overview
Vast amounts of terrain data is available from remote sensing technology. Most data available is
in the form of aerial photographs. Photographs are a great tool for viewing, and they became now
stan
csci 210: Data Structures Linked lists
Summary
Today
linked lists single-linked lists double-linked lists circular lists
READING:
GT textbook chapter 3
Arrays vs. Linked Lists
Weve seen arrays:
int[] a = new int[10]; a is a chunk of memory of size 1
csci 210: Data Structures
Linked lists
Summary
Today
linked lists
single-linked lists
double-linked lists
circular lists
READING:
LC chapter 4.1, 4.2, 4.3
Arrays vs. Linked Lists
Weve seen arrays:
int[] a = new int[10];
a is a chunk of memory of
Computer Science 210:
Data Structures
Introduction
Welcome to Data Structures!
Data structures are fundamental building blocks of algorithms and programs
Csci 210 is a study of data structures
abstract data structures
design
analysis
implementation
use
Computer Science 210:
Data Structures
Arrays
Summary
Today
arrays
arrays of objects
in-class: add an entry into an array
Reading:
Collections of data
The most common thing you want to do when writing algorithms/code is handle a
bunch of data.
How?
csci 210: Data Structures
More Recursion
Summary
Topics: more recursion
Subset sum: finding if a subset of an array that sum up to a given target
Permute: finding all permutations of a given string
Subset: finding all subsets of a given string
Thinkin
Computer Science 210:
Data Structures
Sorting
Sorting
Given a sequence of elements, sort them
More precisely:
Input:
an array a = [a0, a1, a2, . ]
the elements are comparable to each other (we can ask a[i] < a[j] )
Output:
the same array a, rearranged
Computer Science 210:
Data Structures
Java review
Base types
boolean, char, byte, short, int, long, oat, double
Class
A class does not actually exist; it is just a pattern
a type; a cookie cutter; blueprint from which individual objects are created
A clas
Computer Science 210:
Data Structures
Sorting
Sorting
Given a sequence of elements, sort them
More precisely:
Input:
an array a = [a0, a1, a2, . ]
the elements are comparable to each other (we can ask whether a[i] < a[j] )
Output:
the same array a, rear
Computer Science 210:
Data Structures
Searching
Searching
Given a sequence of elements, and a target element, nd whether the target
occurs in the sequence
Variations:
nd rst occurrence
nd all occurrences
nd the number of occurrences, etc
Searching is a
Computer Science 210:
Data Structures
Java review
Monday, September 5, 2011
Base types
boolean, char, byte, short, int, long, oat, double
Class
A class does not actually exist; it is just a pattern
a type; a cookie cutter; blueprint from which individual