DMGT20QUESTIONS

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 43

1. List and Explain laws of the algebra of sets.

Ans.

Explanation of each law by giving example.

2. What are the different types of set representation?


Ans.

1. Tabular Form or Roster Form:

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.

1. The set of all natural numbers which divide {1,2,3,6,7,21}


2. The set of odd numbers less than (20) is {1,3,5,7,9,11,13,15,17,19}.

2. Set Builder form / Notation or descriptive Form.

In set-builder form, all elements of a set share a single common attribute that no
element outside the set possesses. For example,

1. A = {x | x is even number between 0 to 9}


This will be read as A is a set of elements (x) such that (x) is even number between
digits 0 to 9.

2. A = {x | x is a vowels of English Alphabets}


This will be read as A is a set of elements (x) such that (x) is vowels of English
Alphabets
3. A = {x | set of first five natural numbers}
This will be read as A is a set of elements (x) such that (x) set of first five natural
numbers

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:

U = {1,2,3,4,5,6,7,8,9,10} is the universal set for which A = {2,4,6,8,10} and B =


{4,6} are subsets.

3.List and Explain different types of set.

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:

A set is said to be finite if it contains exactly n distinct elements where n


denotes some non negative integer.
Or
A set with countable number of elements is said to be a Finite Set.

Ex. A set consist of vowels


A set consist of five odd / even numbers
A set consist of names of a months in a year

3. Infinite Set:

A set is said to be infinite if it is not finite. Or


A set consist of infinite numbers of elements. Or
A set which is having uncountable elements is said to be Infinite set.

Ex. A {x | x is natural numbers}


A set of positive Integers
A set of Even Integers

4. Empty Set or Null 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

11. Proper Subset:

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

12. Improper Subset:

An improper subset is a subset containing every element of the original set.

A = {a, e, I, o, u}
B = {a, e, I, o, u}

Condition: ACB & BCA

13. Power set:

The collection of all subset of A is called power set of A.


Or
Let A be the finite set, then set of all subsets of A is called power set of A.
It is denoted by P (A).
A = {1, 2, 3}
P(A)= {ϕ, {1}, {2}, {3}, {1,2}, {2,3}, {1,3}, {1, 2, 3}}
The elements in power set will be the 2 n
Where n will be the number of element in set A.
4. What are the different operations on set? Explain.

Ans.

1. Union of set:

Union of sets can be written using the symbol “ ⋃”.


Union of two or more sets is the set containing all the elements of the given sets.

Suppose the union of two sets X and Y can be represented as X ⋃ Y.


The union of two sets X and Y is equal to the set of elements that are present in set X, in set Y,
or in both the sets X and Y.
This operation can be represented as;
X ∪ Y = {a: a ∈ X or a ∈ Y}
For ex.: set A = {1, 3, 5} and set B = {1, 2, 4} then;
A ∪ B = {1, 2, 3, 4, 5}

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 = {2, 4, 5, 6,10,11,14, 21}


B = {1, 2, 3, 5, 7, 8, 11, 12, 13}
A ∩ B = {2, 5, 11}
3. Disjoint Sets

Two sets A and B having no elements in common are said to be disjoint, if A ∩ B


= ϕ, then A and B are called disjoint sets.
Example: If A = {2, 3, 5, 9} and B = {1, 4, 6, 12},
A ∩ B = {2, 3, 5, 9} ∩ {1, 4, 6, 12} = ϕ.
Therefore, A and B are called disjoint sets.
4. Difference of Set:
The difference of the sets A and B in this order is the set of elements which
belong to A but not to B. Symbolically, we write A – B and read as “A minus B”.
The representation of A – B using a Venn diagram is given below.

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}

5.List and Explain Types of Relations.


Ans.

 The Empty Relation between sets X and Y, or on E, is the empty set ∅

 The Full Relation between sets X and Y is the set X×Y

 The Identity Relation on set X is the set {(x, x)|x ∈ X}

 The Inverse Relation R' of a relation R is defined as R′={(b,a)|(a,b)∈R}


Example − If R= {(1, 2), (2, 3)} then R′ will be {(2, 1), (3, 2)}

 A relation R on set A is called Reflexive if ∀a ∈ A is related to a (aRa holds)


Example − The relation R={(a, a), (b, b)} on set X={a, b} is reflexive.

 A relation R on set A is called Irreflexive if no a∈A is related to a (aRa does not


hold).
Example − The relation R={(a,b),(b,a)} on set X={a,b} is irreflexive.

A relation R on set A is called Symmetric if x R y implies y R x, ∀x ∈ A and ∀y


∈ A.

Example − The relation R={(1,2),(2,1),(3,2),(2,3)} on set A={1,2,3} is


symmetric.

Symmetric if xRy and yRx implies x=y∀x∈A and ∀y∈A.


 A relation R on set A is called Anti-

Example − The relation R={(x,y)→N|x≤y} is anti-symmetric


since x≤y and y≤x implies x=y.
The antisymmetric relation on set A = {1,2,3,4} will be;
R = {(1,1), (2,2),(3,3),(4,4)}

A relation R on set A is called Transitive if x R y and y R z implies x R z, ∀x, y,


z ∈ A.

Example − The relation R={(1,2),(2,3),(1,3)} on set A={1,2,3} is transitive.

 A relation is an Equivalence Relation if it is reflexive, symmetric, and transitive.


Example − The relation R={(1, 1), (2, 2), (3, 3), (1, 2), (2, 1), (2, 3), (3, 2), (1,
3), (3, 1)} on set A={1,2,3} is an equivalence relation since it is reflexive,
symmetric, and transitive.

6. Illustrate the distributive law A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) with Venn


Diagram.

7. In a class of 80 students, 50 students know English, 55 know French and 46 know


German language. 37 students know English and French, 28 students know French
and German, 7 students know none of the languages. Find out
a) How many students know all the 3 languages?
b) How many students know exactly 2 languages
c) How many know only one language?

8. Let R and S be the following relations on A= {1,2,3}:


R= {(1,1), (1,2), (2,3), (3,1), (3,3)}
S= {(1,2), (1,3), (2,1), (3,3)}
Find (a) R ∩ S, R U S, R c ;
(b) R o S;
(c) S 2 = S o S.

9. Consider a Set A= {a, b, c} and the relation R on A defined by


R= {(a, a), (a, b), (b, c), (c, c)}
Find: (a) Reflexive(R); (b) Symmetric(R); and (c) Transitive(R).

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.

Predicate Logic - Definition


A predicate is an expression of one or more variables determined on some specific
domain. A predicate with variables can be made a proposition by either authorizing a
value to the variable or by quantifying the variable.
The following are some examples of predicates.

o Consider E(x, y) denote "x = y"


o Consider X(a, b, c) denote "a + b + c = 0"
o Consider M(x, y) denote "x is married to y."
Quantifier:
The variable of predicates is quantified by quantifiers. There are two
types of quantifier in predicate logic - Existential Quantifier and
Universal Quantifier.

If p(x) is a proposition over the universe U. Then it is denoted as ∃x


Existential Quantifier:

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

(∃x∈A)p(x) or ∃x∈A such that p (x) or (∃x)p(x) or p(x)


quantifier, i.e.,

is true for some x ∈A.


Universal Quantifier:

∀x,p(x) and read as "For every x∈U,p(x) is true." The quantifier ∀ is


If p(x) is a proposition over the universe U. Then it is denoted as

called the Universal Quantifier.


There are several ways to write a proposition, with a universal

∀x∈A,p(x) or p(x), ∀x ∈A Or ∀x,p(x) or p(x) is true for


quantifier.

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.

For instance, “If it rains, then they cancel school.”


"It rains" is the hypothesis.
"They cancel school" is the conclusion.

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.”

To form the contrapositive of the conditional statement, interchange the


hypothesis and the conclusion of the inverse statement.

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 .

Contrapositive If not q , then not p .

3. Explain Tautologies, Contradictions and Contingency with example.


4. What is propositional logic? Explain basic logical operation.
A Proposition or a statement or logical sentence is a declarative sentence which is either true or
false, but not both.
Example1: The following statements are all propositions:
o Jawaharlal Nehru is the first prime minister of India.
o 2+2=4
o India is in Asia
o 9<6
Example2: The following statements are not propositions:
o Please report at 11 a.m. sharp
o What is your name?
o x2=13
o Do your Homework.
Syntax and semantics define a way to determine the truth value of the sentence .
Syntax: The statements given in a problem are represented via propositional symbols.
Each sentence consists of a single propositional symbol. The propositional
symbol begins with an uppercase letter and may be followed by some other
subscripts or letters. We have two fixed propositional symbols, i.e., True
and False.
Semantics: It defines the rules to determine the truth of a sentence. A semantic
should be able to compute the truth value of any given sentence.
Connectives
In propositional logic generally we use five connectives which are −
 OR (∨)
 AND (∧)
 Negation/ NOT (¬) (~)
 Implication / if-then (→)
 If and only if (⇔).
OR (∨) − The OR operation of two propositions A and B (written as A∨B) is true if
at least any of the propositional variable A or B is true.
The truth table is as follows –
A B A∨B
True True True
True False True
False True True
False False False
AND (∧) − The AND operation of two propositions A and B (written as A∧B) is true if both the
propositional variable A and B is true.
The truth table is as follows −
A B A∧B
True True True
True False False
False True False
False False False

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

As we can see every value of (A∨B)∧[(¬A)∧(¬B)] is “False”, it is a contradiction.


Contingency
A Contingency is a formula which has both some true and some false values for every value of its
propositional variables.
Example − Prove (A∨B)∧(¬A) a contingency
The truth table is as follows −
A B A∨B ¬A (A ∨ B) ∧ (¬ A)
True True True False False
True False True False False
False True True True True
False False False True False
As we can see every value of (A∨B)∧(¬A) has both “True” and “False”, it is a contingency.

5. Construct the table for (a v b) ⇔[((~a) ∧ c )→(b ∧ c)]

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

4. What is algebraic structure? Define Binary operation of set with examples.


Algebraic Structure
The algebraic structure is a type of non-empty set G which is equipped with one or
more than one binary operation. Let us assume that * describes the binary operation
on non-empty set G. In this case, (G, *) will be known as the algebraic structure. (1,
-), (1, +), (N, *) all are algebraic structures.
(R, +, .) is a type of algebraic structure, which is equipped with two operations (+ and
.)
Binary Operation of Set
In the binary operation, binary stands for two. A binary operation is a type of
operation that needs two inputs, which are known as the operands. When we perform
multiplication, division, addition, or subtraction operations on two numbers, then we
will get a number. The two elements of a set are associated with binary operations.
The result of these two elements will also be in the same set. So we can say that if we
perform a binary operation on a set, then it will perform calculations that combine
two elements of the set and generate another element that belongs to the same set.
Let us assume that there is a non-empty set called G. A function f from G × G to G is
known as the binary operation on G. So f: G × G → G defines a binary operation on
G.
Examples of Binary operation
In this example, we will take the two natural numbers or two real numbers and
perform binary operations such as addition, multiplication, subtraction, and division
on these numbers. The algebraic operation on two natural numbers or real numbers
will generate a result. If we get a natural number or real number as a result, then we
will consider that binary operation in our set.
Addition:
We will learn about addition, which is a binary operation. Suppose we have two
natural numbers(a, b). Now if we add these numbers, then it will generate a natural
number as a result. For example: Suppose there are 6 and 8 two natural numbers and
the addition of these numbers are
6 + 8 = 14
Hence, the result 14 is also a natural number. So, we will consider an addition 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

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

Subtraction: Now we will learn subtraction, which is a binary operation. If we


subtract 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 subtraction, then it is not compulsory that it will
generate a natural number. For example: Suppose we take two natural numbers 5 and
7 and the subtraction of these numbers are
5 - 7 = -2
Hence, the result is not a natural number. So we will not consider subtraction in our
set.
- : R x 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

5. Explain the following in brief:


a. Semigroup
b. Sub semigroups
c. Free Semigroup
d. Monoids
e. Sub Monoids

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:

subsemigroup if the set B is closed under the operation *.


Example: Consider a semigroup (N, +), where N is the set of all natural numbers and
+ is an addition operation. The algebraic system (E, +) is a subsemigroup of (N, +),
where E is a set of +ve even integers.
Free Semigroup:
Consider a non empty set A = {a 1 ,a 2 ,.....a n }.
Now, A* is the set of all finite sequences of elements of A, i.e., A* consist of all
words that can be formed from the alphabet of A.
If α,β,and,γ are any elements of A*, then α,(β. γ)=( α.β).γ.
Here ° is a concatenation operation, which is an associative operation as shown
above.
Thus (A*,°) is a semigroup. This semigroup (A*,°) is called the free semigroup
generated by set A.
Monoid:
Let us consider an algebraic system (A, o), where o is a binary operation on A. Then
the system (A, o) is said to be a monoid if it satisfies the following properties:

1. The operation o is a closed operation on set A.

2. The operation o is an associative operation.

3. There exists an identity element, i.e., the operation o.


Example: Consider an algebraic system (N, +), where the set N = {0, 1, 2, 3,
4...}.The set of natural numbers and + is an addition operation. Determine whether
(N, +) is a monoid.
Solution: (a) Closure Property: The operation + is closed since the sum of two
natural numbers.

(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:

(M, o), if and only if it satisfies the following properties:

1. S is closed under the operation o.

2. There exists an identity element e ∈ T.


Example: Let us consider, a monoid (M, *), where * s a binary operation and M is a
set of all integers. Then (M 1 , *) is a submonoid of (M, *) where M 1 is defined as
M 1 ={a i │i is from 0 to n,a positive integer,and a∈M}.

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

Number of edges = n(n-1)/2


= 20(20-1)/2
=10(19)
=190
Hence, it contains 190 edges.

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

On solving the above quadratic equation, we get;


n ≈ 9.45, -8.45
Since, the number of vertices cannot be negative.
Therefore, n ≈ 9

6. What is graph algorithm? Explain any one.


7. Explain Depth-first search with example.
8. Explain Breadth first search with example.
9. Explain Depth-first search algorithm.
10. Explain Breadth first search algorithm
Graph Algorithm:
Graph algorithms which systematically examine the vertices and edges of a graph G.
1. Depth-first search (DFS)
2. Breadth-first search (BFS)

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.

11. What is shortest path explain with example.


12. Explain Dijkstra’s algorithm.
13. Explain below directed graph by using Dijkstra’s algorithm.
14. Define the following terms. Give one suitable example for each
i) Euler circuit ii) Hamiltonian graph

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.

Here, number of vertices in G1 and G2 = 4


Number of edges in G1 and G2 = 5
Degree sequence of G1 and G2 = 3,3,2,2
Mapping of G1=> G2 :- a=>x, b=>z, c=>w, d=>y.

Graph colouring: A colouring of a graph is the assignment of colours to each vertex


of the graph so that no two adjacent vertices are assigned the same colour.
Chromatic numbers: The minimum number of colours needed for vertex colouring of
a graph G is called the chromatic number of G, denoted by X(g).
In the above diagram, we have colored all the vertices in such a way that no two
adjacent vertexes have same colors.

Planar Graphs: A simple graph without any edge crossing is called Planar Graph.

For Planar Graph: r + v = e + 2 where,


r – Number of regions (Region is a section inside a closed path)
v – Number of vertices
e – Number of edges

Eg: In above figure 1, r = 4, v = 4, e = 6 so,


r+v=e+2
4 + 4 = 6+2 i.e., 8 = 8. Hence it is Planar.
In above figure 2, r = 8, v = 5, e = 10 so,
r+v=e+2
8 + 5 = 10+2 i.e., 13 = 12 which is false. Hence it is not Planar.

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.

Method of insertion in Binary tree


In the starting, the tree contains only one vertex, which is called root. After that, we will
assign the first item, which is known as the key of root.
For example:
o Suppose the root is 45, and we want to insert 39 and 50. In this case, first, 39 will be compared
with 45. Item 39 is less than 45, so it will be added to the left of 45. Item 39 will be known as the
left child of root 45.
o After that, we will insert 50. We will also compare it with 45. Item 50 is greater than 45, so it will
be added to the right of 45. Item 50 will be known as the right child of root 45.

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.

Algorithm of Insertion of Binary search tree


Step 1: START
Step 2: Store the key to be inserted (x)
Step 3: Check element present in tree if not go to step 4 else step 5
Step 4: Make inserted key Root Node
Step 5: Compare x with root node if smaller go to step 6 else go to step 7, or no root node
find goto step 9.
Step 6: Element reaches the left subtree repeat Step 5
Step 7: Element reaches the right subtree repeat Step 5
Step 8: Insert the key
Step 9: STOP

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy