Beruflich Dokumente
Kultur Dokumente
Syllabus:
1
Sets
Definition: Set is a well defined collection of objects
2
Sets
3
Sets
4
Sets
5
Sets
6
Sets
7
Sets
8
Sets
9
Relations
Definition: Let A and B be sets. A binary relation from A
to B is a subset of AB.
In other words, for a binary relation R we have
R AB. We use the notation aRb to denote that (a,
b)R and aRb to denote that (a, b)R.
Example: Let P be a set of people, C be a set of cars,
and D be the relation describing which person drives
which car(s).
P = {Carl, Suzanne, Peter, Carla},
C = {Mercedes, BMW, tricycle}
D = {(Carl, Mercedes), (Suzanne, Mercedes),
(Suzanne, BMW), (Peter, tricycle)}
This means that Carl drives a Mercedes, Suzanne drives
a Mercedes and a BMW, Peter drives a tricycle, and
Carla does not drive any of these vehicles.
10
Relations
11
Relations
12
Equivalence Relations
Equivalence relations are used to relate objects
that are similar in some way.
13
Partial Orders
A partial order is a binary relation "" over a set P
which is reflexive, antisymmetric, and transitive, i.e.,
which satisfies for all a, b, and c in P:
a a (reflexivity);
14
Functions
15
Identity function
A function f from a set A to
the same set A stating that
f(x) = x for all elements of x in
the set A.
Identity function is one one
and onto also.
It is a bijective mapping from
a set into it self.
16
One one function
A function f from a set A to
set B such that for any element of
set B there exists only one
preimage in set A.
If f(a) = f(b) then a = b for
all elements of a,b in set A.
It is also called as injective
or some times 1 1.
17
Onto function
A function from a set A to
set B such that for all elements of
set B there exists at least
one element in set B such that
f(a) = b.
It is also called as surjective
mapping.
Here f(A) = B.
All images are have preimages.
18
One to one function
A function from a set A to set B
with the two properties one one and
onto.
It is also called as 1to1 or some
times bijective mapping
n(A) = n(B)
i. e. both the sets have same
number of elements.
one element to one image and
one image is for one element.
19
Step function
A function f from real numbers
set to integers set stating that
f(x) = y where y-1<x<=y
20
Absolute function
A function from real numbers set to
real numbers set stating that
x if x is > 0
f(x) = -x if x is < 0
0 if x is = 0
21
Recursive Functions
A recursive function is an equation that
recursively defines a sequence, once one or more initial
terms are given: each further term of the sequence is
defined as a function of the preceding terms.
The term difference equation sometimes (and for
the purposes of this article) refers to a specific type of
recurrence relation. However, "difference equation" is
frequently used to refer to any recurrence relation.
22
Sequences
A sequence is an ordered list. Like a set, it
contains members (also called elements, or terms). The
number of ordered elements (possibly infinite) is called
the length of the sequence.
Unlike a set, order matters, and exactly the same
elements can appear multiple times at different positions
in the sequence. Most precisely, a sequence can be
defined as a function whose domain is a countable totally
ordered set, such as the natural numbers.
For example, (M, A, R, Y) is a sequence of letters
with the letter 'M' first and 'Y' last. This sequence differs
from (A, R, M, Y). Also, the sequence (1, 1, 2, 3, 5, 8),
which contains the number 1 at two different positions, is
a valid sequence.
23
Induction Principle
Mathematical induction is a method of
mathematical proof typically used to establish a given
statement for all natural numbers.
It is done in two steps.
The first step, known as the base case, is to prove
the given statement for the first natural number.
The second step, known as the inductive step, is to
prove that the given statement for any one natural
number implies the given statement for the next natural
number.
From these two steps, mathematical induction is
the rule from which we infer that the given statement is
established for all natural numbers.
24
Structural Induction
Structural induction is a proof method that is used in mathematical
logic (e.g., in the proof of o' theorem), computer science, graph theory, and
some other mathematical fields.
It is a generalization of mathematical induction over natural
numbers, and can be further generalized to arbitrary Noetherian induction.
Structural recursion is a recursion method bearing the same relationship to
structural induction as ordinary recursion bears to ordinary mathematical
induction.
Structural induction is used to prove that some proposition P(x)
holds for all x of some sort of recursively defined structure such as lists or
trees.
A well-founded partial order is defined on the structures ("sublist"
for lists and "subtree" for trees).
The structural induction proof is a proof that the proposition holds
for all the minimal structures, and that if it holds for the immediate
substructures of a certain structure S, then it must hold for S also. (Formally
speaking, this then satisfies the premises of an axiom of well-founded
induction, which asserts that these two conditions are sufficient for the
proposition to hold for all x.)
25
Recursive Algorithms
The Nature of Recursion Algorithms
Problems that lend themselves to a recursive solution have the
following characteristics: One or more simple cases of the problem
(called stopping cases) have a simple, non-recursive solution.
For the other cases, there is a process (using recursion) for substituting
one or more reduced cases of the problem that are closer to a stopping
case.
Eventually the problem can be reduced to stopping cases only, all of
which are relatively easy to solve.
if (the stopping case is reached)
{
Solve it
}
else
{
Reduce the problem using
recursion
}
26
Recursive Algorithms
1. To find N!: If N = 1 then N! = 1; Otherwise
N! = N x (N - 1)!
27
Counting
Combinatorics is a branch of mathematics concerning the
study of finite or countable discrete structures.
Aspects of combinatorics include counting the structures of a
given kind and size (enumerative combinatorics), deciding when
certain criteria can be met, and constructing and analyzing objects
meeting the criteria (as in combinatorial designs and matroid theory),
finding "largest", "smallest", or "optimal" objects (extremal
combinatorics and combinatorial optimization), and studying
combinatorial structures arising in an algebraic context, or applying
algebraic techniques to combinatorial problems (algebraic
combinatorics).
Counting is the action of finding the number of elements of a finite
set of objects. The traditional way of counting consists of continually
increasing a (mental or spoken) counter by a unit for every element of the set,
in some order, while marking (or displacing) those elements to avoid visiting
the same element more than once, until no unmarked elements are left; if the
counter was set to one after the first object, the value after visiting the final
object gives the desired number of elements. The related term enumeration
refers to uniquely identifying the elements of a finite (combinatorial) set or
infinite set by assigning a number to each element.
28
Pigeonhole Principle
Pigeonhole principle : If n items are put into m
pigeonholes with n > m, then at least one pigeonhole must
contain more than one item. This theorem is exemplified in
real-life by truisms like "there must be at least two left
gloves or two right gloves in a group of three gloves".
It is an example of a
counting argument, and
despite seeming intuitive
it can be used to demonstrate
possibly unexpected results;
for example, that two people in
London have the same
number of hairs on their heads
29
Permutations and Combinations
Permutation means to the act of permuting
(rearranging) objects or values. Informally, a permutation of
a set of objects is an arrangement of those objects into a
particular order.
30
Permutations and Combinations
Example:
How many permutations of the letter JKLMNOPQ contain the string JKL?
Since the letter JKL must occur in a block, we must consider six objects
namely JKL as one block and M,N,O,P,Q. the six objects can occur in any
order and there are 6! = 720 permutations of the letters JKLMNOPQ in
which JKL occurs as a block
31
Permutations and Combinations
Combinations
Def:An r-combination of elements of a set S is
simply a subset T of S with r members.
32
Permutations and Combinations
Combination is a way of selecting several things out
of a larger group, where (unlike permutations) order does
not matter. In smaller cases it is possible to count the
number of combinations.
33
Recurrence Relations
Recurrence relation is an equation that recursively
defines a sequence, once one or more initial terms are
given: each further term of the sequence is defined as a
function of the preceding terms.
34
Recurrence Relations
Recurrence relations are having fundamental
importance in Analysis of Algorithms. If an algorithm
is designed so that it will break a problem into smaller
sub problems, its running time is described by a
recurrence relation.
35
Recurrence Relations
A better algorithm is called binary search. It will
first check if the element is at the middle of the vector.
36