DMGT20QUESTIONS
DMGT20QUESTIONS
DMGT20QUESTIONS
Ans.
All of the items of a set are listed in roster form, with commas separating them and
braces enclosing them. The order in which the items are listed in a roster is
irrelevant. In addition, an element is not usually repeated when writing the set in
roster form. For example, the set of all even positive integers less than \(9\) is
described in the roster form as {2,4,6,8}. Some more examples of representing a set
in roster form are as follows.
In set-builder form, all elements of a set share a single common attribute that no
element outside the set possesses. For example,
3. Venn Diagram
Venn diagrams can be utilised to depict the majority of the relationships between
sets. Rectangles and closed curves, primarily circles, make up these diagrams. The
universal set is commonly represented by a rectangle, whereas circles represent its
subsets.
The constituents of the sets are written in their corresponding circles in Venn
diagrams. For example, in the below given Venn diagram:
Ans.
1. Singleton Set or Unit Set:
Singleton set or unit set contains only one element. A singleton set is usually
denoted by S.
Ex. S = {1}
A = {a}
S = {x | x € N, 7 < x< 9}
2. Finite Set:
3. Infinite Set:
The empty set is a set which has no elements; It is also called null set or void
set; It is denoted by ϕ or {}.
Ex. Φ = {}
A = {x | x is natural no less than 1}
5. Universal Set:
A Universal set is the set of all elements under consideration. Or A set which
is super set of all sets; It is denoted by U.
Ex.
A = {x | x is the student of class 10}
B = {x | x is the student of class 9}
C = {x | x is the student of class 8}
1. U = {x | x is the student of School}
2. U = {x | x is the student of all School}
6. Equal Set:
Two sets are equal if and only if they have same elements.
Set A and B having same elements then only they are said to be Equal set.
Ex. A = {1, 3, 5, 7}
B = {1, 5, 7, 3}
C = {1, 3, 5, 7} |C| = 4
D = {1, 5, 7, 3, 7, 1} |D| = 4
A = {a, b, c, d}
B = {a, x, y, z}.
7. Equivalent Set:
Two finite sets A and B are said to be equivalent if they have same numbers of
elements, that is n (a) = n (B)
Ex. A = {1, 3, 5, 7}
B = {1, 5, 7, 3}
A = {p, q, r, s, t}
B = {a, b, c, d}
8. Cardinality of sets:
A special and simple aspect of sets that mathematicians are always interested
in, is the total number of distinct elements of a set whether it is a finite set or
infinite. This property is very important since it allows us to know the size of a
set and compare the different sets among many other things.
At the first look, this idea of cardinality is a very simple one we just need to
count the elements of a given set to determine its cardinality, and that is totally
true when we are dealing with finite sets, but the idea of cardinality isn’t that
clear and simple to grasp when it comes to infinite sets and comparing the size
of infinite sets!
The cardinality of a set A is noted |A| and sometimes in some references, it is
noted by Card (A) or n(A)
Note that the cardinality of the empty set is 0:
Note also that we count only the distinct elements so for example,
B = {2, 3, 5, 7, 9, 11, 3, 13, 17, 2, 5}.
|B| = 8
9. Subset of Set:
If every element of set A is also element of Set B, then A is a subset of B.
Subset is denoted by “ C ”.
Every set is subset of itself, A C A.
Ex.: A = {1, 2, 3, 4, 5}
B = {1, 2, 9, 5, 10, 3, 6, 4, 5}
ACB
10. Superset:
When A is a subset of B, then B is a super set of A.
Superset is denoted by “ Ͻ”
A = {1, 2, 3, 4, 5}
B = {1, 2, 9, 5, 10, 3, 6, 4, 5}
B ϽA
If A is a subset of B, then A does not contain every element of set B, then set
A is called proper set. Denoted by C
A = {a, e, i}
B = {a, e, I, o, u}
ACB
Condition: B& A
ACB
A = {a, e, I, o, u}
B = {a, e, I, o, u}
Ans.
1. Union of set:
2. Intersection of set:
The intersection of two given sets is the set that contains all the elements that are common to
both sets.
The symbol for the intersection of sets is "∩''.
For any two sets A and B, the intersection, A ∩ B (read as A intersection B) lists all the
elements that are present in both sets, the common elements of A and B.
A = {1, 2, 3, 4, 5, 6}
B = {3, 4, 5, 6, 7, 8}
A-B = {1, 2}
B-A = {7, 8}
X = {11, 12, 13, 14, 15}
Y = {10, 12, 14, 16, 18}
Z = {7, 9, 11, 14, 18, 20}
(i) X – Y – Z = {11, 12, 13, 14, 15} – {10, 12, 14, 16, 18} – {7, 9, 11, 14, 18, 20}
= {13, 15}
(ii) Y – X – Z = {10, 12, 14, 16, 18} – {11, 12, 13, 14, 15} – {7, 9, 11, 14, 18, 20}
= {10, 16}
(iii) Z – X – Y = {7, 9, 11, 14, 18, 20} – {11, 12, 13, 14, 15} – {10, 12, 14, 16, 18}
= {7, 9, 20}
Suppose two sets A and B are equal then, A – B = A – A = ∅ (empty set) and B – A = B – B =
SOME OF THE PROPERTIES RELATED TO DIFFERENCE OF SETS:
∅.
A = {1, 2, 3, 4, 5, 6} - ∅
∅ – A=∅
A -∅ = A
A = {1, 2, 3, 4, 5}
B = {1, 2, 9, 5, 10, 3, 6, 4, 5}
A–B=∅
The difference between a set and an empty set is the set itself, i.e, A – ∅ = A.
The difference of a set from an empty set is an empty set, i.e, ∅ – A = ∅.
The difference of a set, say A from universal set U is equal to empty set, i.e. A – U = ∅.
When a superset is subtracted from a subset, then result is an empty set, i.e, A – B = ∅ if A ⊂
B
If A and B are disjoint sets (no common elements for A and B), then A – B = A and B – A = B.
5. Symmetric Difference
For two sets A and B, symmetric difference is the set (A-B) U (B-A) denoted by A
∆B
6. Cartesian product
A new set can be constructed by associating every element of one set with every
element of another set. The Cartesian product of two sets A and B, denoted
by A × B, is the set of all ordered pairs (a, b).
Examples:
{1, 2} × {red, white, green} = {(1, red), (1, white), (1, green), (2, red), (2, white),
(2, green)}.
{1, 2} × {1, 2} = {(1, 1), (1, 2), (2, 1), (2, 2)}.
{a, b, c} × {d, e, f} = {(a, d), (a, e), (a, f), (b, d), (b, e), (b, f), (c, d), (c, e), (c,
f)}.
Some basic properties of Cartesian products:
A × (B ∪ C) = (A × B) ∪ (A × C).
A × ∅ = ∅.
(A ∪ B) × C = (A × C) ∪ (B × C).
7. Complement of a Set
If U is a universal set and A is any subset of U then the complement of A is the set of all
members of the universal set U which are not the elements of A.
A′ = {x: x ∈ U and x ∉ A}
U = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
A = {2, 3, 5, 7, 11, 13}
A′= {1, 4, 6, 8, 9, 10, 12, 14, 15}
1. Find the Greatest common Divisor (GCD) of 414 and 662 using
Euclidean algorithm.
2. If the HCF of 210 and 55 is expressible in the form, 210*5+55y and find y.
1. What is Predicate Logic and Explain Essential and Universal Quantifiers.
variable x such that p(x) is true. The quantifier ∃ is called the existential
p(x) and read as "There exists at least one value in the universe of
quantifier.
There are several ways to write a proposition, with an existential
all x ∈A.
2. What is Converse, Inverse, Contrapositive.
Given an if-then statement "if p , then q ," we can create three related statements:
A conditional statement consists of two parts, a hypothesis in the “if” clause and a
conclusion in the “then” clause.
To form the converse of the conditional statement, interchange the hypothesis and
the conclusion.
The converse of "If it rains, then they cancel school" is "If they cancel
school, then it rains."
To form the inverse of the conditional statement, take the negation of both the
hypothesis and the conclusion.
The inverse of “If it rains, then they cancel school” is “If it does not rain, then
they do not cancel school.”
The contrapositive of "If it rains, then they cancel school" is "If they do not
cancel school, then it does not rain."
Statement If p , then q .
Converse If q , then p .
Inverse If not p , then not q .
Negation (¬) − The negation of a proposition A (written as ¬A) is false when A is true and is true
when A is false.
The truth table is as follows −
A ¬A
True False
False True
Implication / if-then (→) − An implication A→B is the proposition “if A, then B”. It is false if A
is true and B is false. The rest cases are true.
The truth table is as follows −
A B A→B
True True True
True False False
False True True
False False True
If and only if (⇔) − A⇔B is bi-conditional logical connective which is true when p and q are
same, i.e. both are false or both are true.
The truth table is as follows −
A B A⇔B
True True True
True False False
False True False
False False True
Tautologies
A Tautology is a formula which is always true for every value of its propositional variables.
Example − Prove [(A→B)∧A]→B is a tautology
The truth table is as follows −
A B A→B (A → B) ∧ A [( A → B ) ∧ A] → B
True True True True True
True False False False True
False True True False True
False False True False True
As we can see every value of [(A→B)∧A]→B is "True", it is a tautology.
Contradictions
A Contradiction is a formula which is always false for every value of its propositional variables.
Example − Prove (A∨B)∧[(¬A)∧(¬B)] is a contradiction
The truth table is as follows −
A B A∨B ¬A ¬ B (¬ A) ∧ ( ¬ B) (A ∨ B) ∧ [( ¬ A) ∧ (¬ B)]
True True True False False False False
True False True False True False False
False True True True False False False
False False False True True True False
6.
1.
2.
3. List and Explain properties of Algebraic Structure.
Commutative: Suppose set G contains a binary operation *. The operation * is
called to be commutative in G if it holds the following relation:
x * y= y * x for all x, y in G
Associative: Suppose set G contains a binary operation *. The operation * is
called to be associative in G if it holds the following relation:
(x*y)*z = x *( y*z) for all x, y, z in G
Identity: Suppose we have an algebraic system (G, *) and set G contains an
element e. That element will be called an identifying element of the set if it
contains the following relation:
x * e = e * x = x for all x Here, element e can be referred to as an identity
element of G, and we can also see that it is necessarily unique.
Inverse: Suppose there is an algebraic system (G, *), and it contains an identity e.
We will also assume that the set G contains the elements x and y. The element y
will be called an inverse of x if it satisfies the following relation:
x*y=y*x=e
Here, element x can also be referred to as inverse of y, and we can also see that it
is necessarily unique. The inverse of x can also be referred to as x-1 like this:
x * x-1 = x-1 * x = e
Cancellation Law: Suppose set G contains a binary operation *. The operation * is
called to be left cancellation law in G if it holds the following relation:
x * y = x * z implies y = z
It will be called the right cancellation law if it holds the following relation:
y * x = z * x implies y = z
Multiplication:
Now we will learn multiplication, which is a binary operation. If we multiply two
natural numbers (a, b), then it will generate a natural number as a result. For
example: Suppose there are 10 and 5 two natural numbers and the multiplication of
these numbers are:
10 * 5 = 50
Hence, the result 50 is also a natural number. So we will consider multiplication in
our set. The same process will be followed for real numbers as well.
+: N × N → N is derived by (a, b) → a × b
+: R × R → R is derived by (a, b) → a × b
Division Now we will learn division, which is a binary operation. If we divide two
real numbers (a, b), then it will also generate a real number as a result. The same
process will not be followed for natural numbers, because if we take two natural
numbers to perform binary division, then it is not compulsory that it will generate a
natural number. For example: Suppose we take two natural numbers 10 and 6 and the
division of these numbers is
10/6 = 5/3
Hence, the result 5/3 is not a natural number. So we will not consider division in our
set.
- : R - R → R is derived by (x, y) → x - y
SemiGroup
Let us consider, an algebraic system (A, *), where * is a binary operation on A. Then,
the system (A, *) is said to be semi-group if it satisfies the following properties:
1. The operation * is a closed operation on set A.
2. The operation * is an associative operation.
Example: Consider an algebraic system (A, *), where A = {1, 3, 5, 7, 9....}, the set of
positive odd integers and * is a binary operation means multiplication. Determine
whether (A, *) is a semi-group.
Solution: Closure Property: The operation * is a closed operation because
multiplication of two +ve odd integers is a +ve odd number.
every a, b, c ∈ A, we have
Associative Property: The operation * is an associative operation on set A. Since
(a * b) * c = a * (b * c)
Hence, the algebraic system (A, *), is a semigroup.
Consider a semigroup (A, *) and let B ⊆ A. Then the system (B, *) is called a
Subsemigroup:
(a+b)+c=a+(b+c) ∀ a, b, c ∈ N.
(b)Associative Property: The operation + is an associative property since we have
(c)Identity: There exists an identity element in set N the operation +. The element 0
is an identity element, i.e., the operation +. Since the operation + is a closed,
associative and there exists an identity. Hence, the algebraic system (N, +) is a
monoid.
Let us consider a monoid (M, o), also let S ⊆M. Then (S, o) is called a submonoid of
SubMonoid:
Q.1: If a complete graph has a total of 20 vertices, then find the number of edges
it may contain.
Solution: The formula for the total number of edges in a k graph is given by;
15
Q.2: If a graph has 40 edges, then how many vertices does it have?
Solution: As we know,
Number of edges = n (n-1)/2
40 = n(n-1)/2
n(n-1) = 80
n – n – 80 = 0
2
Any particular graph algorithm may depend on the way G is maintained in memory. Here
we assume G is maintained in memory by its adjacency structure. Our test graph G with
its adjacency structure appears in the following Fig. where we assume the vertices are
ordered alphabetically.
During the execution of our algorithms, each vertex (node) N of G will be in one of three
states, called the status of N, as follows:
STATUS = 1: (Ready state) The initial state of the vertex N.
STATUS = 2: (Waiting state) The vertex N is on a (waiting) list, waiting to be
processed.
STATUS = 3: (Processed state) The vertex N has been processed.
The waiting list for the depth-first search (DFS) will be a (modified) STACK (which we
write horizontally with the top of STACK on the left), whereas the waiting list for the
breadth-first search (BFS) will be a QUEUE.
1. Depth-first Search:
The general idea behind a depth-first search beginning at a starting vertex A
is as follows. First, we process the starting vertex A. Then we process each vertex N
along a path P which begins at A; that is, we process a neighbor of A, then a neighbor of
A, and so on. After coming to a “dead end,” that is to a vertex with no unprocessed
neighbor, we backtrack on the path P until we can continue along another path P . And so
on. The backtracking is accomplished by using a STACK to hold the initial vertices of
future possible paths. We also need a field STATUS which tells us the current status of
any vertex so that no vertex is processed more than once.
The depth-first search (DFS) algorithm appears in Fig. 8-31. The algorithm will
process only those vertices which are connected to the starting vertex A, that is, the
connected component including A. Suppose one wants to process all the vertices in the
graph G. Then the algorithm must be modified so that it begins again with another vertex
(which we call B) that is still in the ready state (STATE = 1). This vertex B can be
obtained by traversing through the list of vertices
Example:
Suppose the DFS Algorithm 8.5 in Fig. 8-31 is applied to the graph in Fig. 8-
30. The vertices will be processed in the following order: A, D, L, K, C, J, M, B
Specifically, Fig. 8-32(a) shows the sequence of vertices being processed and the
sequence of waiting lists in STACK. (Note that after vertex A is processed, its
neighbors, B, C, and D are added to STACK in the order first B, then C, and finally
D; hence D is on the top of the STACK and D is the next vertex to be processed.)
Each vertex, excluding A, comes from an adjacency list and hence corresponds to an
edge of the graph. These edges form a spanning tree of G which is pictured in Fig. 8-
32(b). The numbers indicate the order that the edges are added to the spanning tree,
and the dashed lines indicate backtracking.
2. Breadth-first Search:
The general idea behind a breadth-first search beginning at a starting vertex A is
as follows. First we process the starting vertex A. Then we process all the neighbors of A.
Then we process all the neighbors of neighbors of A. And so on. Naturally we need to keep
track of the neighbors of a vertex, and we need to guarantee that no vertex is processed
twice. This is accomplished by using a QUEUE to hold vertices that are waiting to be
processed, and by a field STATUS which tells us the current status of a vertex.
The breadth-first search (BFS) algorithm appears in Fig. Again the algorithm will
process only those vertices which are connected to the starting vertex A, that is, the
connected component including A. Suppose one wants to process all the vertices in the
graph G. Then the algorithm must be modified so that it begins again with another vertex
(which we call B) that is still in the ready state (STATUS = 1). This vertex B can be
obtained by traversing through the list of vertices.
Euler Path (Eulerian Path): A path which consists all edges of given graph without
repetition of any edges is known as Euler path. A graph which consists Euler path is knows
as Euler graph or Eulerain.
Hamiltonian path (cycle): A cycle in which all vertices of a graph are covered is knows as
Hamiltonian cycle. Here, each vertex is visited exactly once except the end node (which is
equal to start node). A graph which consists of Hamiltonian path(cycle) is knows
Hamiltonian graph. Here, in the below diagram, the red path shows the Hamiltonian path.
In the below diagram, Hamiltonian cycle is not possible because during traversing nodes are
repeated more than one time. Hence, this is not a Hamiltonian graph.
15. Explain the terms given below,
i. Isomorphism
ii. Graph coloring
iii. Planar Graph
iv. Coloring Vertices
v. Edge Coloring
Isomorphism: Two graph G1 and G2 are said to be same when they have same
properties as follows: 1. Number of vertices. 2. Number of edges. 3. Degree
sequence. 4. Mapping.
Planar Graphs: A simple graph without any edge crossing is called Planar Graph.
Colouring vertices: For colouring the vertices of the graph we use WelchPowell
Algorithm.
Steps for Welch-Powell Algorithm:
The input is Graph G.
1) Order the vertices of G according to decreasing degrees.
2) Assign the first colour C1 to the first vertex and then, in sequential order, assign C1
to each vertex which is not adjacent to a previous vertex which was assigned C1.
3) Repeat step 2 with a second colour C2 and colour the other vertices which are not
coloured in such a way that no two adjacent vertices are of same colour.
4) Repeat step 3 with a third colour C3, then a fourth colour C4, and so on until all
vertices are coloured.
5) Exit.
Edge Colouring: Assignment of colours to each edge of the graph so that no two adjacent
edges are assigned the same colour is called edge colouring.
Example: Show the binary search tree after inserting 3, 1,4,6,9,2,5,7 into an
initially empty binary search tree.
Solution: The insertion of the above nodes in the empty binary search tree is
shown in fig:
16. Explain Binary search tree with example.
17. Write down the method of insertion in binary tree.
18. Write an Algorithm of Insertion of Binary search tree with example.
Trees
A Tree can be described as a collection of nodes, known as a graph with connecting lines or
edges between the nodes. So we can say that lines are used to connect all the nodes. The
first node of the tree is known as the root.
The various application of tree is described as follows:
Binary Search Tree
The most important task is searching for items in a list. Our main goal is to efficiently
search the items when they are ordered by implementing the search algorithm. We can use
the binary search tree so that we can accomplish it. In the binary search tree, each child of
the vertex is divided into the right child or subtree or left child or subtree. Both the subtree
of a vertex (left or right child) can only be one. Every vertex of a tree has a value known as
a key. The left subtree of a vertex is used to contain various vertices with keys, but this key
must be less than the key of vertex. The right subtree of a vertex is used to contain various
vertices with keys, but this key must be greater than the key of vertex. The right subtree and
left subtree should be a binary search tree.
If we want to insert more items, we have to follow the above procedure. That means we will first compare
items with the root. According to this comparison, we will compare it with the left or right child. If the
new item is less than the left child, it will move to the left of this left child otherwise, it will move to the
right of this left child. Otherwise, we will compare the new item with the right child. If the new item is
greater than the right child, it will move to the right of this right child otherwise, it will move to the left of
this right child.