Study Notes for Sun Certified Programmer for Java 2 Platform
Disclaimers
No claims are made about the accuracy of this document and no responsibility is taken for any errors. The
exam objectives below are quoted, as is from Sun Microsystems web site. This
Classical Sequent Calculus (LK)
for Propositional Logic
CS 245
Idea: make a proof system that manipulates assumptions as well as the formula that is being proven.
Denition 1 (Sequent)
Let and be sets of formulae. We call
a sequent.
Notation: In sequents
The Completeness of Propositional Resolution
A Simple and Constructive Proof
Jean Gallier
Department of Computer and Information Science
University of Pennsylvania
Philadelphia, PA 19104, USA
jean@saul.cis.upenn.edu
September 25, 2006
Abstract. It is well
Example Grammar
V = cfw_expr, op
= cfw_ID, +
P = cfw_expr ID,
expr expr op expr,
op +
S = expr
Top-down parsing
Algorithm 1 Generic algorithm
S
while = input do
choose any A such that = A
oracle chooses such that A P or rejects
end while
Algorithm 2 Ge
Linking Algorithm
Suppose we have les f1.merl, f2.merl, . fn.merl that we wish to link together into
one le linked.merl.
1. Concatenate code:
offset[1] = 0
for i from 1 to n:
copy code from fi.merl into the file linked.merl
offset[i+1] = offset[i]+codelen
The Halting Problem for Scheme Programs
(version of November 24, 2011)
Testing Whether a Program Halts
Some Scheme programs terminate after a nite number of steps; others do not. For example,
consider the following.
( define (loop) (loop) )
With this deni
Propositional Logic
Summary of Denitions and Main Results
CS 245, SE 212
Fall 2011
1
Syntax of Propositional Logic
Statements of propositional logic come from a formal language, denoted Lp . A formal language consists
of strings over an alphabet.
Denition
Modal Logic
Summary of Denitions and Main Results
CS 245
1
Syntax of Modal Logic
The alphabet for modal (propositional) logic is the same as for propositional logic with the addition of an
additional unary connectives 2 (called necessarily or always) and
Pseudocode 1 Printing a parse tree: printTree (node )
Input: node : root of parse tree
Output: string containing printed parse tree
ret string representing node + "\n"
if node is a non-terminal node then
for each child c of node do
ret ret + printTree (c
CS246Assignment 5, Group Project (Fall 2011)
B. Lushman
R. Ahmed
Due Date 1: Friday, November 25, 5pm
Due Date 2: Monday, December 5, 11:59pm
This project is intended to be doable by two people in two weeks. Because the
breadth of students ablilities in t
CS246Assignment 4 (Fall 2011)
B. Lushman
R. Ahmed
Due Date 1: Friday, November 11, 5pm
Due Date 2: Friday, November 18, 5pm
Questions 1a and 2a are due on Due Date 1; the remainder of the assignment is
due on Due Date 2.
Note: You must use the C+ I/O stre
CS246Assignment 3 (Fall 2011)
B. Lushman
R. Ahmed
Due Date 1: Friday, October 21, 5pm
Due Date 2: Friday, November 4, 5pm
Questions 1, 2a, and 3a are due on Due Date 1; the remainder of the assignment
is due on Due Date 2.
Note: You must use the C+ I/O st
CS246Assignment 2 (Fall 2011)
B. Lushman
R. Ahmed
Due Date 1: Friday, October 7, 5pm
Due Date 2: Friday, October 14, 5pm
Questions 1, 2, 3a, 4, 5a are due on Due Date 1; the remainder of the assignment
is due on Due Date 2.
Note: On this and subsequent as
CS246Assignment 1 (Fall 2011)
B. Lushman
R. Ahmed
Due Date 1: Friday, September 23, 5pm
Due Date 2: Friday, September 30, 5pm
Questions 1 ae and 2a are due on Due Date 1; the remainder of the assignment is
due on Due Date 2.
1. Provide a Unix command line
CS246Assignment 0
B. Lushman
R. Ahmed
Due: Wednesday, September 21, 2011, 6pm
This assignment is designed to get you familiar with the most basic aspects of working with
Unix, and with assignment submission. It is not worth any marks, but you must get 100
Lecture 24 Coping with NPC and
Unsolvable problems.
When a problem is unsolvable, that's generally very bad
news: it means there is no general algorithm that is
guaranteed to solve the problem in all cases.
However, it's rare that we actually want the c
Lecture 23. Subset Sum is NPC
The Subset Sum Problem: Given a set of
positive integers S and a "target" t. Question: Is
there a subset S' of S such that the sum of the
elements of S' is equal to t ?
For example, if S =
cfw_35,54,384,520,530,672,831,935
Lecture 22 More NPC problems
Today, we prove three problems to be NP-
complete
3CNF-SAT
Clique problem
Vertex cover
Dick Karp
3-CNF SAT is NP-complete
A boolean formula is in 3-conjunctive normal
form (3-CNF) if it consists of clauses
connected by AND
Lecture 21 NP-complete problems
Why do we care about NP-complete problems?
Because if we wish to solve the P=NP problem, we need to
deal with the hardest problems in NP.
Why do we want to solve the P=NP problem?
Because it will solve other 3000 NPC pro
Lecture 20. Computational Complexity
So far in this course we have discussed two
sorts of problems: problems that are efficiently
solvable, like shortest paths or matrix
multiplication, and problems that are unsolvable.
In between the two, however, are p
Lecture 19. Reduction: More
Undecidable problems
It turns out that many problems are undecidable.
In fact, many problems are even harder than being
undecidable. You can actually have an infinite
hierarchy of undecidable problems - each level
contains pr
Lecture 18. Unsolvability
Kurt Gdel
Before the 1930s, mathematics was not like today.
Then people believed that everything true must be
provable. (More formally, in a powerful enough
mathematical system, a true statement should be
provable as a theorem.
Lecture 17 Path Algebra
Matrix multiplication of adjacency matrices of directed
graphs give important information about the graphs.
Manipulating these matrices to study graphs is path
algebra.
With "path algebra" we can solve the following problems:
Co
Lecture 16. Shortest Path Algorithms
The single-source shortest path problem is the following: given a
source vertex s, and a sink vertex v, we'd like to find the shortest
path from s to v. Here shortest path means a sequence of directed
edges from s to
Lecture 15. Graph Algorithms
An undirected graph G is a pair (V,E), where V is a finite
set of points called vertices and E is a finite set of edges.
An edge e E is an unordered pair (u,v), where u,v
V.
In a directed graph, the edge e is an ordered pai
Lecture 13: Adversary Arguments
continues
This lecture, we continue with the adversary
argument by giving more examples.
Example 4. Largest and Second Largest
Problem: given a list of n elements, find the
2nd largest. [Reference: S. Baase, Computer Alg
Lecture 12: Lower bounds
By "lower bounds" here we mean a lower bound on the complexity
of a problem, not an algorithm. Basically we need to prove that no
algorithm, no matter how complicated or clever, can do better than
our bound. This is often hard!
Lecture 11 Deterministic Selection
The goal is to determine the i'th smallest element from a list of n
elements in linear time. No random numbers are used.
The algorithm is due to Blum, Floyd, Pratt, Rivest, and Tarjan
(1973). The idea is the same as RA