CMPS 284 Computer Networks
Fall 2016-2017
Chapter 2 Application Layer
Prof. Ahmad R. Dhaini
Lecture slides are in courtesy of Jim Kurose and Keith Ross; modified and updated by Ahmad R. Dhaini
Application Layer
v application:
supporting network
applicatio
Technical Note
Structural Concrete Software System
TN220_waffle_slab_design_042420
POST-TENSIONED WAFFLE/JOIST SLAB CONSTRICTION1
Where concrete is relatively expensive, spans are generous, and it is not critical to select the
smallest floor thickness, a
CMPS 200
Introduction to Programming
What is computer
science?
Computer Science
The study of theoretical foundations of information and
computation and their implementation and application in
computer systems. - Wikipedia
Many subfields
Graphics, Comp
Building Java Programs
Chapter 8
Classes
Our task
In the following slides, we will implement a Point class
as a way of learning about defining classes.
We will define a type of objects named Point.
Each Point object will contain x/y data called fields.
E
CMPS 200
Introduction to Programing
Primitive Data Types, Expressions, Variables
Data types
type: A name for a category or set of data values that
are related, as in type int in java, which used to
represent integer values.
Constrains the operations tha
Building Java Programs
Chapter 4
Conditional Execution
The if statement
Executes a block of statement(s) only if a test is true (i.e., condition is
satisfied)
if (test) cfw_
statement;
.
statement;
Example:
double gpa = Double.parseDouble(args[0]);
if (
Building Java Programs
Chapter 3
Parameters and Return Values
Declaring a parameter
Stating that a method requires a parameter in order to run
public static void methodName ( type paraName ) cfw_
statement(s);
Example:
public static void sayPassword(int
Building Java Programs
Objects
String, Character and Scanner
Strings
string: An object storing a sequence of text characters.
Unlike most other objects, a String is not created with
new.
String name = "text";
String name = expression;
Examples:
String
CMPS 200
Introduction to Programing
loops, Scope, Pseudo-code
Repetition with for loops
So far, repeating a statement is redundant:
System.out.println("Homer says:");
System.out.println("I am so smart");
System.out.println("I am so smart");
System.out.pr
3.2 Creating Data Types
IntroductiontoProgramminginJava:AnInterdisciplinaryApproachRobertSedgewickandKevinWayneCopyright20084/2/164/2/16
Data Types
Data type. Set of values and operations on those values.
Basic types.
Data Type
Set of Values
Some Operatio
3.2 Creating Data Types
IntroductiontoProgramminginJava:AnInterdisciplinaryApproachRobertSedgewickandKevinWayneCopyright20084/2/164/2/16
Data Types
Data type. Set of values and operations on those values.
Basic types.
Data Type
Set of Values
Some Operatio
1.4 Arrays
IntroductiontoProgramminginJava:AnInterdisciplinaryApproachRobertSedgewickandKevinWayneCopyright20084/2/164/2/16
A Foundation for Programming
any program you might want to write
objects
functions and modules
graphics, sound, and image I/O
array
1.4 Arrays
IntroductiontoProgramminginJava:AnInterdisciplinaryApproachRobertSedgewickandKevinWayneCopyright20084/2/164/2/16
A Foundation for Programming
any program you might want to write
objects
functions and modules
graphics, sound, and image I/O
array
Faculty of Arts & Sciences
Department of Computer Science
CMPS 200Introduction to Programming
Assignment 7 Due Mon. Mar 28, 2016 11:55 pm
Exercises
1. Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is eve
Faculty of Arts & Sciences
Department of Computer Science
CMPS 200Introduction to Programming
Lab 9 Spring 2016
Exercise 1
SubArrays
Given two int arrays, check if one is a sub array in another
Example:
isSubarray(cfw_1,2,3, cfw_0,1,2,3,4) -> true
isSubar
Building Java Programs
Supplement 3G
Graphics
Graphical objects
We will draw graphics in Java using 3 kinds of objects:
DrawingPanel: A window on the screen.
Not part of Java; provided by the textbook (moodle).
Graphics: A "pen" to draw shapes
and line
Discrete Mathematics
CMPS 211
Applications of
Recurrence Relations
Section 8.1 of the textbook
Recurrence Relations
Definition: A recurrence relation for the sequence
cfw_an is an equation that expresses an in terms of
one or more of the previous terms of
Discrete Mathematics
CMPS 211
The Basics of Counting
Section 6.1 of the textbook
Basic Counting Principles: The Product Rule
The Product Rule: A procedure can be broken
down into a sequence of two tasks. There are n1 ways
to do the first task and n2 ways
Discrete Mathematics
CMPS 211
Divide-and-Conquer Algorithms
and Recurrence Relations
Section 8.3 of the textbook
Divide-and-Conquer Algorithmic Paradigm
Definition: A divide-and-conquer algorithm works by
first dividing a problem into one or more instance
Discrete Mathematics
CMPS 211
Recursive Algorithms
Section 5.4 of the textbook
Recursive Algorithms
Definition: An algorithm is called recursive if
it solves a problem by reducing it to an
instance of the same problem with smaller
input
For the algorithm
CMPS 211
Section 2.3 of the textbook
Functions
Definition: Let A and B be nonempty sets. A function f
from A to B, denoted f: A B is an assignment of each
element of A to exactly one element of B. We write
f(a) = b if b is the unique element of B assigned
CMPS 211
Section 2.2 of the textbook
Operators in Set Theory
The operators in set theory are analogous to the
corresponding operators in propositional logic
As always there must be a universal set U
All sets are assumed to be subsets of U
Union
Defini
Discrete Mathematics
CMPS 211
Strong Induction
Section 5.2 of the textbook
Strong Induction
Strong Induction: To prove that P(n) is true for
all positive integers n, where P(n) is a
propositional function, complete two steps:
Basis Step: Verify that the p
CMPS 211
Section 2.1 of the textbook
Sets
A set is an unordered collection of objects
The students in this class
The chairs in this room
The objects in a set are called the elements, or
members of the set
A set is said to contain its elements
The no
Discrete Mathematics
CMPS 211
Recursive Definitions
Section 5.3 of the textbook
Recursively Defined Functions
Definition: A recursive or inductive
definition of a function consists of two steps
BASIS STEP: Specify the value of the function at
zero (first
Discrete Mathematics
CMPS 211
Mathematical Induction
Section 5.1 of the textbook
Climbing an
Infinite Ladder
Suppose we have an infinite ladder:
1. We can reach the first rung of the ladder
2. If we can reach a particular rung of the ladder,
then we can r
Discrete Mathematics
CMPS 211
Complexity of Algorithms
Section 3.3 of the textbook
The Complexity of Algorithms
Given an algorithm, how efficient is this
algorithm for solving a problem given input of
a particular size? To answer this question, we
ask
How
Discrete Mathematics
CMPS 211
The Growth of Functions
Section 3.2 of the textbook
The Growth of Functions
In computer science, we want to understand
how quickly an algorithm can solve a problem
as the size of the input grows
We can compare the efficiency
Discrete Mathematics
CMPS 211
Algorithms
Section 3.1 of the textbook
Problems and Algorithms
In many domains there are key general
problems that ask for output with specific
properties when given valid input
The first step is to precisely state the
proble
Discrete Mathematics
CMPS 211
Inference
Section 1.6 of the textbook
Revisiting the Socrates Example
We have the two premises
All men are mortal
Socrates is a man
And the conclusion
Socrates is mortal
How do we get the conclusion from the
premises?
Inferen