Q.1:-Discuss Binary Search Tree and Represent Binary Search Tree in Memory. Answer
Q.1:-Discuss Binary Search Tree and Represent Binary Search Tree in Memory. Answer
Q.1:-Discuss Binary Search Tree and Represent Binary Search Tree in Memory. Answer
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.
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.
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.
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).
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.
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.
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;
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;
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.
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) }
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.
12