You are on page 1of 12

Name Aroosa Fida

Roll no BX614841
Program :B.Ed (2.5)
Specialization : Science Education
Course code :8674
ASSIGNMENT No 2
Q.1:- Discuss Binary search tree and represent Binary search tree in
memory.
Answer: A binary tree is a hierarchical data structure in which each node has at most
two children generally referred as left child and right child.

Each node contains three components:


✓ Pointer to left sub tree
✓ Pointer to right sub tree
✓ Data element

The topmost node in the tree is called the root. An empty tree is represented by NULL
pointer. A representation of binary tree is shown:

1
✓ Binary Search Tree - Used in many search applications where data is
constantly entering/leaving, such as the map and set objects in many
languages' libraries.

✓ Binary Space Partition - Used in almost every 3D video game to determine


what objects need to be rendered.

✓ Binary Tries - Used in almost every high-bandwidth router for storing


routertables.

✓ Hash Trees - used in p2p programs and specialized image-signatures in which


a hash needs to be verified, but the whole file is not available.

✓ Heaps - Used in implementing efficient priority-queues, which in turn are used


for scheduling processes in many operating systems, Quality-of-Service in
routers, and A* (path-finding algorithm used in AI applications, including
robotics and video games). Also used in heap-sort.

✓ Huffman Coding Tree (Chip Uni) - used in compression algorithms, such as


those used by the .jpeg and .mp3 file-formats.

✓ GGM Trees - Used in cryptographic applications to generate a tree of


pseudorandom numbers.

✓ Syntax Tree - Constructed by compilers and (implicitly) calculators to parse


expressions.

2
✓ Treap - Randomized data structure used in wireless networking and memory
allocation.

✓ T-tree - Though most databases use some form of B-tree to store data on the
drive, databases which keep all (most) their data in memory often use T-trees
to do so.

Q.2:- Discuss argument and Show that the propositions and p ˅ q are
logically equivalent.
Solution:-
=
~((p
p q r p r (p r) q r) q)

T T T T T F

T T F F F T

T F T T F T

T F F F F T

F T T F F T

F T F F F T

F F T F F T

F F F F F T
p ˅q =
p q ~p ~q ~p ~q

T T F F F

T F F T T

F T T F T

F F T T T

Hypothesis:
3
S1:~p ~q
Conclusion:
S:~((p r) q)

p q r ~p ~q S1 p r (p r) q S
~p ~q ~((p r) q)

T T T F F F T T F

T T F F F F F F T

T F T F T T T F critical row T

T F F F T T F F critical row T

F T T T F T F F critical row T

F T F T F T F F critical row T

F F T T T T F F critical row T

F F F T T T F F critical row T

The conclusion (S) is true in all critical rows. So the argument is logically valid.

Q.3:- (a): Prove that Proof:-

4
The second part is not possible because power mistake in this parts.

(b): Discuss Taylor series, Gregory Newton formula and Leibnitz rule
Taylor series of a function is an infinite sum of terms that are expressed in
terms of the function's derivatives at a single point. For most common functions, the
function and the sum of its Taylor series are equal near this point. Taylor's series are
named after Brook Taylor, who introduced them in 1715.

If zero is the point where the derivatives are considered, a Taylor series is also called
a Maclaurin series, after Colin Maclaurin, who made extensive use of this special
case of Taylor series in the 18th century.

The partial sum formed by the first n + 1 terms of a Taylor series is a polynomial of
degree n that is called the nth Taylor polynomial of the function. Taylor polynomials
are approximations of a function, which become generally better as n increases.
Taylor's theorem gives quantitative estimates on the error introduced by the use of
such approximations. If the Taylor series of a function is convergent, its sum is the
limit of the infinite sequence of the Taylor polynomials. A function may differ from the
sum of its Taylor series, even if its Taylor series is convergent. A function is analytic
at a point x if it is equal to the sum of its Taylor series in some open interval (or open
disk in the complex plane) containing x. This implies that the function is analytic at
every point of the interval (or disk).

The Taylor series of a real or complex-valued function f (x) that is infinitely


differentiable at a real or complex number a is the power series

where n!
denotes the factorial of n. In the more compact sigma notation, this can be written as

where f(n)(a) denotes the nth derivative of f evaluated at the point a. (The derivative of
order zero of f is defined to be f itself and (x − a) 0 and 0! are both defined to be 1.)
5
Leibnitz Theorem is basically the Leibnitz rule defined for derivative of the
antiderivative. As per the rule, the derivative on nth order of the product of two
functions can be expressed with the help of a formula. The functions that could
probably have given function as a derivative are known as antiderivatives (or primitive)
of the function. The formula that gives all these antiderivatives is called the indefinite
integral of the function, and such process of finding antiderivatives is called
integration. Now let us discuss here the formula and proof of Leibnitz rule.

Suppose there are two functions u(t) and v(t), which have the derivatives up to nth
order. Let us consider now the derivative of the product of these two functions.

The first derivative could be written as;


(uv)’ = u’v+uv’
Now if we differentiate the above expression again, we get the second derivative;
(uv)’’
= [(uv)’]’
= (u’v+uv’)’
= (u’v)’+(uv’)’
= u′′v + u′v′ + u′ v′ + uv′′
= u′′v + 2u′v′ + uv′′
Similarly, we can find the third derivative;
(uv)′′′
= [(uv)′′]′
= (u′′v + 2u′v′ + uv′′)′
= (u′′v)′ + (2u′v′)′ + (uv′′)′
= u′′′v + u′′v′ + 2u′′v′ + 2u′v′′ + u′v′′ + uv′′′
= u′′′v + 3u′′v′ + 3u′v′′ + uv′′′
Now if we compare these expressions, it is found very similar to binomial expansion
raised to the exponent.

If we consider the terms with zero exponents, u0 and v0 which correspond to the
functions u and v themselves, we can generate the formula for nth order of the
derivative product of two functions, in a such a way that;

6
This formula is known as Leibniz Rule formula and can be proved by induction.

Leibnitz Theorem Proof:


Assume that the functions u(t) and v(t) have derivatives of (n+1)th order. By
recurrence relation, we can express the derivative of (n+1)th order in the following
manner:

Upon differentiating we get;

The summation on the right side can be combined together to form a single sum, as
the limits for both the sum are the same. Now, let us take an intermediate index such
that 1≤m≤n. So, when i = m, then the first term can be written as;

The second term when i=m-1 will be;

On adding these two terms, we get;

We know from the concept of combinatorics that;

7
Based on the above concept, we can write the sum of these two terms, when i =m and
when i = m-1, as;

From the above expression, we can see when the value of m changes from 1 to n, this
generated combination will cover all the terms from i= 1 to i=n, but not i=0 in the first
term and i = 1 in the second term which are equal to;

Hence, the resulted derivative of (n+1)th order of the product of two functions is given
by;

Hence, we have derived here the Leibnitz formula.

IN a highly interesting critical account of the mathematical work of JAMBS


GREGORY (1638-1675), written for the Proceedings of the Edinburgh Mathematical
Society, by the late Professor G. A. Gibson, there occurs something of a mathematical
puzzle. A pair of formulae are quoted, which certainly are striking examples of the
analytical power of Gregory, and which run as follows:

8
Gibson adds that "there is another formula, but it is of a very complicated character
and I do not reproduce it." It will be convenient to refer to the above pair as formulae
A' and B', and to the more complicated but analogous series as formula C, and to the
original series, from which the above were transcribed, as formulae A and B.

Q.4:- Discuss sub-graphs, Isomorphic graphs, homomorphic graphs, Hamiltonian


graphs and Euler’s formula with examples.
Answer:- A graph (denoted as G=(V,E)) consists of a non-empty set of vertices or nodes
V and a set of edges E.
Isomorphism
If two graphs G and H contain the same number of vertices connected in the same
way, they are called isomorphic graphs (denoted by G H).

It is easier to check non-isomorphism than isomorphism. If any of these following


conditions occurs, then two graphs are non-isomorphic –

✓ The number of connected components are different


✓ Vertex-set cardinalities are different
✓ Edge-set cardinalities are different
✓ Degree sequences are different

9
A homomorphism from a graph GG to a graph HH is a mapping (May not be a bijective
mapping)h:G→H such that − (x,y) E(G)→(h(x),h(y)) E(H). It maps adjacent vertices of
graph GG to the adjacent vertices of the graph H.

Properties of Homomorphisms:
✓ A homomorphism is an isomorphism if it is a bijective mapping.
✓ Homomorphism always preserves edges and connectedness of a graph.
✓ The compositions of homomorphisms are also homomorphisms.
✓ To find out if there exists any homomorphic graph of another graph is a NP
complete problem.

Euler Graphs
A connected graph G is called an Euler graph, if there is a closed trail which includes
every edge of the graph G. An Euler path is a path that uses every edge of a graph
exactly once. An Euler path starts and ends at different vertices.

An Euler circuit is a circuit that uses every edge of a graph exactly once. An Euler
circuit always starts and ends at the same vertex. A connected graph G is an Euler
graph if and only if all vertices of G are of even degree, and a connected graph G is
Eulerian if and only if its edge set can be decomposed into cycles.

Hamiltonian Graphs:
A connected graph G is called Hamiltonian graph if there is a cycle which includes
every vertex of G and the cycle is called Hamiltonian cycle. Hamiltonian walk in graph
GG is a walk that passes through each vertex exactly once.

If G is a simple graph with n vertices, where n≥3 If deg(v)≥n2 for each vertex v, then
the graph G is Hamiltonian graph. This is called Dirac's Theorem.
If G is a simple graph with n vertices, where n≥2 if deg(x)+deg(y)≥n for each pair of
non-adjacent vertices x and y, then the graph G is Hamiltonian graph. This is called
Ore's theorem.

10
Q.5:- (a): Let be the directed graph with vertex set V } and
edge set: E(G) }

(1) Identify any loops or parallel edges


A loop is an edge with the same initial and terminal points; hence (a, a) and (g, g) are
loops. Two edges are parallel if they have the same initial and terminal points. Thus
(a, e) and (a, e) are parallel edges.

(2) Are there any sources in ?


The vertex d is a source since no edge ends in d, that is, d does not appear as the
second element in any edge. There are no other sources.

(3) Are there any sinks in


Both c and f are sinks since no edge begins at c or at f , that is, neither c nor f appear
as the first element in any edge. There are no other sinks.

(4) Find the subgraph of determined by the vertex set .


Let E′ consist of all edges of G whose endpoints lie in V ′ = {a, b, c, d}. This yields E′ =
{(a, a), (d, b)}. Then H = H(V ′, E′).

b. Discuss Sequential representation of directed graphs


Answer: In sequential representation, we use adjacency matrix to store the mapping
represented by vertices and edges. In adjacency matrix, the rows and columns are
represented by the graph vertices. A graph having n vertices, will have a dimension n
x n.

An entry Mij in the adjacency matrix representation of an undirected graph G will be


1 if there exists an edge between Vi and Vj.

An undirected graph and its adjacency matrix representation is shown in the following
figure.

11
in the above figure, we can see the mapping among the vertices (A, B, C, D, E) is
represented by using the adjacency matrix which is also shown in the figure.

There exists different adjacency matrices for the directed and undirected graph. In
directed graph, an entry Aij will be 1 only when there is an edge directed from Vi to
Vj.

A directed graph and its adjacency matrix representation is shown in the following
figure.

Representation of weighted directed graph is different. Instead of filling the entry by


1, the Non- zero entries of the adjacency matrix are represented by the weight of
respective edges.

12

You might also like