Birthday: Month: _ Day: _
a) What is the output of the following code? Write your answer in the box.
When you create
the new array the
values are set to 0
int myArray = cfw_1, 2, 3, 4, 5;
myArray = new int;
2-3 Trees (BST)
Every node has 2 or 3 children; each
node stores 1 or 2 entries. Each
internal node has one more child than
entries. Perfectly balanced: find,
insert and remove take O(log n) even
in the worst case. The splitting
process is applied
CS 61BL: Midterm 1
Login: cs61blCourtney Wang
1. Put your name and login at the top of every page.
2. Attempt all or as many questions as you can. We cant giv
CS 61B: Lecture 19
Friday, March 8, 2013
Sierra & Bates, p. 664.
ENCAPSULATED LISTS (a case study in encapsulation)
Homeworks 3, 4, and 5 introduced you to three different implementations of
linked lists, each fund
CS 61B: Lecture 18
Wednesday, March 6, 2013
Sierra & Bates, pp. 80-84.
A _module_ is a set of methods that work together as a whole to perform some
task or set of related tasks. A module is _encapsulate
CS 61B: Lecture 10
Wednesday, February 13, 2013
Sierra & Bates, pp. 95-109, 662.
Every class has an equals() method. If you dont define one explictly, then
"r1.equals(r2)" returns the same boolean value as
CS 61B: Lecture 1
Wednesday, January 23, 2013
Prof. Jonathan Shewchuk, [email protected]
Email to prof & all TAs at once (preferred): [email protected]
Todays reading: Sierra & Bates, pp. 1-9, 18-19, 84.
Handout: Course Overview (also availabl
* Compilation: javac StdDrawPlus.java
* Standard drawing library. This class provides a basic capability for
* creating drawings with your programs. It uses a simple graphics model that
* allows you to create drawings co
* Represents a ShieldPiece in Checkers61bl
public class ShieldPiece extends Piece cfw_
* Define any variables associated with a ShieldPiece object here.
* variables MUST be private or package private.
* Represents a BombPiece ins Checkers61bl
public class BombPiece extends Piece cfw_
* Constructs a new BombPiece
* @param side what side this BombPiece is on
* @param b
Board that this BombPiece belongs to
public class TimerTest extends TestCase cfw_
public void testDiff() cfw_
ArrayList<Integer> arr = new ArrayList<Integer>();
LinkedList<Integer> link = new LinkedList
public class ListTest extends TestCase cfw_
public void testConstructor() cfw_
List l1 = new List();
assertEquals ("( )", l1.toString();
CS 61B: Lecture 20
Monday, March 11, 2013
Goodrich & Tamassia, Chapter 4 (especially 4.2 and 4.3).
Next, you must learn how to express this idea rigorously. Here is the
central lesson of todays lecture, which will be
CS 61B: Lecture 21
Wednesday, March 13, 2013
Theta is symmetric: if f(n) is in Theta(g(n), then g(n) is in Theta(f(n).
For instance, n^3 is in Theta(3 n^3 - n^2), and 3 n^3 - n^2 is in Theta(n^3).
n^3 is not in Theta(n), and n is not
CS 61B: Lecture 24
Wednesday, March 20, 2013
Goodrich & Tamassia, Chapter 7.
A _tree_ consists of a set of nodes and a set of edges that connect pairs of
nodes. A tree has the property that there is ex
Algorithms Case Study:
Quote of the Week: It would be reasonable to suppose
that a routine time or an eventless time would seem
interminable. It should be so, but it is not. It is the dull
eventless times that have no duration whatsoever. A
Review and Additional Data
Quote of the Week: You know people for a
reason, a season, or a lifetime.
via Samantha Eng, source unknown
Regex puzzle hunt winning teams
Will be announce on piazza tonight, after I
confer with the TAs
ADTs, Hashing, Gitlet Intro
Quote of the week: More than cleverness, we
need kindness and gentleness.
Abstract Data Types, or ADTs, are purely
theoretical descriptions of data structures
Described only in terms of behavior and the
operations they sup
Welcome to CS 61BL!
Quote of the week: Speak casually, but never think casually.
Lets introduce the staff
Your TAs! Say hello to them if you see them around!
Lets introduce the staff
NOT a professor. A Berkeley alumnus.
Call me Joseph, or Joe, or Joey
Debugging, Big O, Lists
Quote of the week: If we are indeed in as bad a state as I take us to
be, pessimism will turn out to be one more cultural luxury that we
shall have to dispense with in order to survive in these hard times.
You have an exam coming u
Problem 1. (10 points) A miscellany.
int arr = new int;
arr = new int;
arr = new int;
arr = new int;
Another way to do this is with an initializer:
int arr = cfw_new int, new int, new int;
Practice for the Final Exam
We will cover some of these questions for review, but please attempt these
questions before that comes to pass. Starred problems are particularly
difficult-much more difficult than any exam questio
CS 61B: Lecture 27
Wednesday, April 3, 2013
A 2-3-4 tree is a perfectly balanced tree. It has a big advantage over regular
binary search trees: because the tree is perfectly balanced, find, insert, and
remove operations tak
CS 61B: Lecture 29
Monday, April 8, 2013
Breadth-first search (BFS) is a little more complicated than depth-first
search, because its not naturally recursive. We use a queue so that vertices
are visited in order a
CS 61B: Lecture 28
Friday, April 5, 2013
A graph G is a set V of vertices (sometimes called nodes), and a set E of edges
(sometimes called arcs) that each connect two vertices together. To confuse
you, mathematicians often