Computer Science & Engineering Information Theory English Medium
Computer Science & Engineering Information Theory English Medium
=0111
• If a word is referenced now then the same word 43, 61, 19)
will be referenced again in future. 6
Hit ratio = ×100 = 40
• LRU is used in temporal locality. 15
Cache Replacement Algorithms– 9
Miss = ×100 = 60
• Replacement policy is required for associative 15
mapping and set associative mapping but not for (iii) Direct mapping
direct mapping.
M M M M M M M M M M M
• Replacement policies are aimed to minimize miss 5, 5, 12, 13, 17, 4, 12, 13, 17, 2, 13,
Penalty for future references.
M H M M M
19, 13, 43, 61, 19
• Consider a K segment pipeline with clock cycle Assume in cycle number 5, I4 decoded as branch
time = tp to perform n tasks. instruction.
Time required to perform 1st task = K*tp
By standard ⇒ Branch decision is made in
Time required to perform remaining (n –1) tasks =
'Execution' phase.
(n–1)tp
Time required for all n tasks = (K+n–1)tp • After execution phase next instruction can be
(K + n – 1) is total cycle. fetched.
• Consider a non-pipeline system that takes tn time Actually only instruction executed (n = 6) K = 5 for
to perform a task n input, no. of cycles = K+ n – 1
Time required for n task = n*tn =5+6–1
• Performance of a pipeline is given by speed up = 10
ratio. 3 cycles are extra (stall cycles because of branch)
Non − pipeline time Total = 10 + 3 = 13 cycles
Speed up ratio =
Pipeline time Total execution time = cycle * tp
n * tn Pipeline Hazards– Situations that prevent the next
S= instruction from being executing its designated
( K + n − 1) t p clock cycle.
as the number of task increases, n>>K (Ignore K–1) • Hazard lead to have stall cycles
tn There are three type–
Sideal =
tp 1. Structural Hazard/Resource Conflict
2. Data Hazard/Data Dependency
Latency– Time after machine takes next input.
3. Control Hazard/Branch difficulty
• Latency in non-pipeline = tn
Structural Hazard– When multiple instruction
• Latency in pipeline = tp
need same resource.
Throughput– No of input processed per unit of
Control Hazard– All Instruction who change the
n
time = program counter leads to control hazard because of
( K + n − 1) t p branch instruction.
Ideal case– Data Hazards Classification–
1 • RAW (Read After Write) [Flow/true data
Throughput =
tp dependency]
Example– Consider a 5 stage pipeline with cycle time • WAR (Write After Read) [Anti Data dependency]
of 15 ns. Calculate processing time of pipeline • WAW (Write After Write) [Output data
for 500 tasks. dependency]
Computer Organization and Architecture 10 YCT
BINARY TREE
• Binary tree is a finite set of data item which is either empty
of consists of a single item called root and two disjoint
binary tree called the left sub tree and right sub tree.
BASIC OPERATION OF QUEUE
• In Binary tree, every node can have maximum of two
• Enqueue: Add an element to the end of the queue. children which are known as left child and right child.
• Dequeue: Remove an element from the front of the
queue.
• Is Empty: Check if the queue is Empty.
• Is full: Check if the queue is full.
• Peek: Get the value of the front of the queue without
removing it.
Application of Queue-
• CPU scheduling, Disk scheduling
• Handling of interrupts in real time system
• Call center phone system use Queues to hold people Types of Binary Tree
calling them in order. Full Binary Tree- A Binary tree is full if every node
• Unlike stack, Queue is also considered as the ordered has 0 or 2 child.
list of the data the ordered list of the data that has a
similar data type.
Priority Queue- Priority Queue is an Extension of
queue with following properties. An element with high
priority is dequeued before an element with low
priority.
Operations-
• Insert (item, priority): Inserts an item with given
priority time (O(logn)).
Data Structure and Algorithm 14 YCT
Search on TG: @apna_pdf
Complete Binary Tree- A Binary tree is complete m
Internal nodes =
Binary tree if all level are completely filled. 2
• Every node has max. (m-1) keys
• Min key:- root node → 1
m
all other = − 1
2
GRAPH
Graph in data structure are non linear data structure
made up of a finite number of vertices and the edges
Perfect Binary Tree- A Tree in which all internal that connect them. Graph in data structure are used to
nodes has two children and all leaves are at the same address real problem in which it represents the real
level in which all level has 2n children. problem in which it represents the problem area as a
network like telephone networks, circuit network and
social network.
Insert operation is called Insert operation is called In this Pre-order, In- In this BFS and DFS
PUSH operation. Enqueue operation. order and post order traversal.
Traversal.
Delete operation is called Delete operation is called
POP operation. Dequeue operation. HEAP DATA STRUCTURE
In stack There is no In Queue there is a wastage A Heap is a special Tree-based structure in which the
wastage of memory space. of memory space. tree is complete binary tree.
Plate counter at marriage Students standing in a line
Reception is an Example at fees counter is an
of stack. Example of Queue.
f(n) = θ(g(n))
Worst Case Analysis– The case that causes a
maximum number of operation to be executed.
Best Case Analysis– The case that causes a minimum
number of operations to be executed .
Average Case Analysis– We take all possible inputs
and calculate the computing time for all of the inputs,
1. Big O Notation sum all calculate values and divide the sum by the total
• The Big O Notation defines an upper bound of an number of inputs.
algorithm. Therefore, it gives the worst-case
complexity of an algorithm.
• O (g(n)) = {f(n): there exist positive constants C
and n0 such that
O ≤ f (n) ≤ Cg(n) for all n > n0
BUBBLE SORT
Algorithm–
1. Start with an array of unsorted numbers
2. Defines a function called 'bubblesort" that takes in
the array and the length of the array as parameters.
3. In the function, create a variable called "sorted" that
2. Omega (Ω) Notation:
is set to false.
Omega notation represents the lower bound of the 4. Create a for loop that iterates through the array
running time of an algorithm. thus, it provides the best starting at index 0 and ending at the length of the
case complexity of an algorithm. array –1
5. Within the for loop, compare the current element
with the next element in the array.
6. If the current element is greater than the next elements,
swap their positions and set "sorted" to true.
7. After the for loop, check if "sorted" is true.
8. If "sorted" is true, call the "bubblesort" function
again with the same array and length as parameters.
9. If "sorted" is false, the array is now sorted and the
3. Theta (θ) Notation: function will return the sorted array.
Theta notation encloses the function from above and 10. Call the "bubbleSort" function with the initial
unsorted array and its length as parameters to befin
below. It is used for analyzing the average case
the sorting process.
complexity of an algorithm.
• It is stable sorting techniques.
C1g ( n ) ≤ f ( n ) ≤ C 2 g ( n )
• Recursive relation in Bubble sort.
C1C 2 ≥ 0, n ≥ n 0 , n 0 ≥ 1 T(n) = T (n-1) +n
Data Structure and Algorithm 18 YCT
Search on TG: @apna_pdf
• It is In place sorting = θ (n2)
• Time complexity = θ (n2) space = θ(n)
Space complexity = 1 + n • Stable sorting
= θ (n) QUICK SORT
Best case = θ (n) • It is Divide and conquer technique.
Worst case = θ (n2) • It is unstable sorting
Average case = θ (n2) • Best case = θ (n logn) = Average case
SELECTION SORT Worst case = θ (n2)
Algorithm– • Recursive
1. Initialize minimum value(min_idx) to location 0. T(n) = 2T(n/2)+n
2. Traverse the array to find the minimum element in Using master theorem
the array. θ (n logn)
3. While traversing if any element smaller than min_idx n(n − 1)
• Number of comparison =
is found then swap both the values. 2
4. Then, increment min_idx to point to the next Merge Sort
element. Algorithm–
5. Repeat until the array is sorted. MergeSort(arr[],l,r)
• Recursive relation If r > 1
T(n) = T (n - 1) +(n - 1) 1. Find the middle point to divide the array into two
• Max swap = (n-1) Complexity θ(n) halves.
• Min swap = 0 middle m = l + (r – 1)/2
2. Call mergeSort for first half:
Call mergeSort(arr, l, m)
3. Call mergeSort for second half:
Call mergeSort(arr, m + 1, r)
4. Merge the two halves sorted in steps 2 and 3:
Call merge(arr, l, m, r)
• It is stable sorting.
• It is pure divide & conquer.
• It is unstable sorting • Recursive–
T(n)= 2T(n/2)+n
INSERTION SORT
• Complexity–
Algorithm– To sort an array of size N in ascending Best case = Average case = Worst case = θ(n logn)
order:
RADIX SORT
1. Iterate from arr[1] to arr[N] over the array.
• It is counting Based sorting.
2. Compare the current element (key) to its predecessor.
3. If the key element is smaller than its predecessor, • It is outplace sorting
compare it to the elements before. Move the greater • Q (n k)
elements before. Move the greater elements one
position up to make space for the swapped element.
n ( n − 1) • Q (n*R) space complexity.
• Number of comparison– max =
2 RECURSION
min = n – 1 A recurrence is an equation or inequality that describes a
function in terms of its values on smaller inputs. To solve a
• Best case = θ(n)
Recurrence Relation means to obtain a function defined on
Worst case & Average case = θ(n2) the natural numbers that satisfy the recurrence.
• Insertion sort = Position +Shifting • There are four methods for solving Recurrence
• It is highly affected due to order of input. (i) Substitution method (iii) Iteration method
• Recursive time T (n) = T (n-1)+n (ii) Recursion tree (vi) Master method
Data Structure and Algorithm 19 YCT
Search on TG: @apna_pdf
(i) Substitution method– T(n)=T(n-2)+n-1]+n…...(ii)
1 n = 0 T(n)=T(n-3)+(n-2)+(n-1)+n……(iii)
T(n) =
T(n − 1) + 1 n >o :
∵ T(n) = T(n − 1) + 1......(i) : Continue of k time
T(n) = T(n − 1) + 1 :
∴ T(n − 1) = T(n − 2) + 1.......(ii)
Substitution T(n − 1) T(n)=T(n-k)+(n-(k-1))+(n-(k-2)+……+(n-1)+n
Assume n-k=0
T(n) = [T(n − 2) + 1] + 1 {From equ x
(ii)}
∴n = k
T(n) = T(n − 2) + 2
T(n)=T(0)+1+2+3+…..n-1+n
T(n) = T(n − 3) + 3
n(n + 1)
⋮ =1+
⋮ Continue for k time 2
⋮ n(n + 1)
T(n)=1+ = θ(n) 2
T(n) = T(n − k) + k Assume n − k = 0 2
T(n) = T(n − n) + n ∴n = k • T(n) = 2T(n − 1) + 1
T(n) = T(0) + n By solving recursion tree
T(n) = 1 + n ∴ θ(n) 1+2+23+…..+2K = 2k+1 (This is GP series)
= θ(2n)
(ii) Recursion Tree – (iv) Master theorem for Decreasing function
T(n)= aT(n-b)+f(n)
1 n = 0
T(n)= a>0, b>0 and f(n)=O(nK) where K≥0
T(n − 1) + n n > 0
Case
• If a<1 • If a=1 • If a>n
O(nk) O(nK+1) O(nKan/b)
O(f(n)) O(n*f(n)) O(f(n)an/b)
• Master Theorem for Dividing function
(i) logba T(n)=a T(n/b)+f(n)
a≥1
(ii) b> f(n)=θ(nklogPn)
Case1: if logba>k them θ(nlogba)
Case2: if logba=k
If P>-1 θ(nklogp+1n)
If P=-1 θ(nklog log n)
If P<-1 θ(nk)
Case3: If logba<K If P ≥ 0 θ(nklogpn)
If P < 0 O(nk)
T(n) = 2T(n/2) + 1
n(n + 1) a = 2, b = 2, f(n) = O(1) = θ(n0log0n)
0+1+2…….n-1+n= log22 = 1 > K = 0
2
Case1: θ(n1)
n(n + 1)
T(n) = Recurrence Relation
2
T(n) = T(n − 1) + 1 O(n)
θ(n 2 )
T(n) = T(n − 1) + 1 O(n 2 )
(iii) Iteration Method– T(n) = T(n − 1) + log n O(n logn)
1 n = 0 T ( n ) = T ( n − 1) + n 2 O(n 3 )
T(n)=
T(n − 1) + n n > 0 T(n) = T(n − 2) + 1
n
O (n)
T(n)=T(n-1)+n {∵ T(n) = T(n − 1) + 2 2
T(n)=[T(n-1)+n-1]+n…..(i) {T(n-1)=T(n-2)+n-1 T(n) = T(n − 100) + n O(n 2 )
fun(Si +1 , K) + C(Vj , K)
Example- List– x1, x2, x3, x4, x5
Size– 20 30 10 5 30 Fun (Si, Vj)= min
C(Vj , D) if Si = Sfi − 1
A K −1[i, j]
Ak[i, j] = min k −1 K −1
A [i, k] + A [k, j]
Time Complexity = O(n3)
Space Complexity = O(n3)
K∀Si +1
Data Structure and Algorithm 22 YCT
Search on TG: @apna_pdf
Bellman Ford Algorithm • On encountering an entry whose value is not same as
the value stored in the entry immediately about it,
mark the row label of that entry.
• After all the entries are scanned the marked labels
represent the items that must be put into the
knapsack.
Example-
O/1 Knapsack problem
m = 8 P = {1, 2, 5, 6}
n = 4 w = {2, 3, 4, 5}
Value of V
V[4, 5] = max[V[3, 5], {V[3, 5-5]+6]}
= max[5, 0] = 5
V[4, 6] = max[V[3, 6], {V[3, 6-5]+6]}
go on relaxing all the edges(n − 1) times
= max[6, 6] = 6
n = number of verites
V[4, 7] = max[V[3, 7], {V[3, 2]+6]}
if ([u] + c(u, v) < d[v]) = max[7, 7] = 7
d[v] = d[u] + c(u, v) V[4, 8] = max[V[3, 8], {V[3, 3]+6]}
= max[7, 8] = 8
Edges- 0 1 2 3 4 5 6 7 8
(A, B), (A, C), (A, D), (B, E), (C, E), (D, C), (D, F), (E,
Pi Wi 0 0 0 0 0 0 0 0 0 0
F), (C, B)
We are done algorithm 5 time. 1 2 1 0 0 1 1 1 1 1 1 1
A-0, B-1, C-3, D-5, E-0, F-3 2 3 2 0 0 1 2 2 3 3 3 3
Single Source Shortest Path 5 4 3 0 0 1 2 5 5 6 7 7
Time Complexity = O(E(|v|-1) 6 5 4 0 0 1 2 5 6 6 7 8
= O(E.V)
= O(n2)
x1 x2 x3 x4
0/1 Knapsack Problem Solution = {2, 6}
0 1 0 1
• Consider– Knapsack weight capacity = w
Number of items each having some weight Optimal Binary Search Tree
and value = n A set of integers are given in the sorted order and
another array to frequency count. Our task is to create a
• Problem solving steps–
binary search tree with those data to find the maximum
(i) Draw a table say 'T' with (n+1) number or row and
cost for all searches.
(w+1) number of column.
Example-
(ii) Fill all the boxes of 0th row and 0th column with
1 2 3 4
zeroes as
Key 10 20 30 40
(iii) Start filling the table row wise top to bottom from
left to right. frequency 4 2 6 3
Using formula
V[i, w]=max{v(i-1, w), v[i-1, w-w[i]]+P[i]} Formula–
Here V [i, w]= maximum value of the selected items [i, j]= min{C[i, k-1]+C[k, j]}+w(i, j) i<k≤j
if we can take items 1 to i and weight restrictions of w.
• This step leads to completely filling the table.
• Then value of the last box represents the maximum
possible value that can be put into the knapsack.
• The knapsack to obtain that maximum profit.
• Consider the last column of the table.
• Start scanning the entries from bottom to top.
[Always try to color with minimum colors] g(1{2, 3,4})= min {C1k g(k{2,3, 4)} − {k}}
k ←{2, 3, 4}
Solution– Ĉ=5
u=8
J2, J3=16
Note–If NP-Hard or NP-Complete is solved in
J1J4=8
polynomial time, then NP=P
LOWER BOUND THEORY • If NP-Hard or NP- Complete problem is proven to be
L(n) to be the running time of an algorithm A, then g(n) not solvable in polynomial time, then P!=NP
is the lower bound of the algorithm A. It there are two But, till date it is not possible to find out whether
constants C and N such that
NP= P or not.
L(n)>=C*g(n), for n>n
• Status of NP is still unknown.
( )
1 if vi , v j is an edges
a ij =
0 other wise
if (V1, Vj) is an edges otherwise
(2) Incidence Matrix– Let G be a graph with m
Here d(V1) = 2, d(V2) ,= 4, d(V3) = 2, d(V4) = 3, vertices V1, V2, ..... Vm and n edges e1, e2,e3 ..... en
d(V5) = 2, d(V6) = 2, d(V7) = 1, d(V8) = 0 Let a matrix M = [Mij]m×n defined by
Discrete Mathematics 34 YCT
Search on TG: @apna_pdf
1 If the vertex Vi is incident on the ij WEIGHTED GRAPH– A graph is called weighted
graph if a non-negative integer W(e) associate to each
m ij = 0 If Vi is not incident on ij
2 If V is an end of the loop ij edge and this W(e) is a weight of corresponding edge.
i
GRAPH COLORING– Painting all the vertices of a
Path Matrix– Suppose G is a simple directed graph with graph with colours such that no two adjacent vertices
m vertices then path matrix P and Bm have same non zero have the same color is called coloring of graph.
entries where Bm = A1 + A2 + A3...... Am. CHROMATIC NUMBER– The least number of
Where A is adjacency matrix colors required for coloring of a graph G is called its
ISOMORPHISM OF GRAPH chromatic number.
Definition– Two graphs G1 & G2 are isomorphic if Note–1. The chromatic number of graph G is denoted by
X(G).
(i) Number of vertices are same.
2. If X(G) = K, then the graph is called K-chromatic.
(ii) Number of edges are same.
3. Chromatic number of null graph is 1.
(iii) An equal number of vertices with given degree
4. Chromatic number of complete graph Kn of n
(iv) Vertex correspondence & edge correspondence valid.
vertices is n.
Homeomorphic Graph 5. If a graph is circuit with n vertices then.
Two graph G and G' are said to be homeomorphic if they (i) It is 2-chromatic if n is even
can be obtained from the same graph. (ii) If is 3-chromatic if n is odd.
Note–If G & G' are homeomorhpic they need not be TREE AND ITS PROPER TIES
insomorphic. TREE– A tree is a connected graph without any
WALK, TRAIL and PATH loop or circuits.
(1) Walk– A walk is a finite alternating sequence v1 Rooted Tree– A rooted tree is a tree in which one
e1 v2 e2 v3 e3 ... vn en of vertices and edges beginning vertex is root.
and ending with same or different vertices. SPANNING TREE–If G is any connected graph a
(i) Length of the walk– The number of edge is called spanning tree in G is a subgroup T of G, which is a tree.
length of the walk. Minimal Spanning Tree– Let G be a weighted
(ii) Closed & open walk– A walk is said to be closed if graph. A minimal spanning with minimum weight.
its origin & terminus vertex (V0 = Vn) is equal Algorithms For Minimal Spanning Tree
otherwise it is called open walk. KRUSHKAL's Algorithm
Trail: Any walk having different edges called trail. Working Rule
Cycle– A closed trail is called circuit. (i) Choose an edge of minimal weight
Path: A walk is called path if all vertices are not (ii) Al each step, choose the edge whose inclusion
repeated. will not create a circuit.
(iii) If G has n vertices stop after (n–1) edges.
Cycle– A closed path is called cycle.
Example–
EULERIAN PATH– A path in a graph is said to be
an Eulerian path if it traverses each edge in the
graph once and only once.
EULERIAN GRAPH– A connected graph which
contain a Eulerian circuit is called Eulerian graph.
HAMILTONIAN PATH– A path which contain
every vertex of a graph G exactly once is called
Hamiltonian graph. Weight = 3+1+2+1=7
HAMILTONIAN CIRCUIT– A circuit that passes (2) PRIM'S ALGORITHM
through each of the vertices in a graph G exactly one Working Rule–
except the starting vertex & end vertex is called (i) Select any vertex & choose the edge and smallest
Hamiltonian circuit. weight from G
HAMILTONIAN GRAPH– A connected graph (ii) At each stage, choose the edge of smallest weight joining
which contain Hamiltonial circuit is called a vertex already included to vertex not yet included.
Hamiltonian Graph. (iii) Continue until all vertices are included.
Discrete Mathematics 35 YCT
Binary System– The binary system uses base 2 to represent different value. Therefore, the binary system is also
known as base-2 system. As this system used base2, only two symbols. are available for representing the different
values in this system. These symbols are 0 and 1, Which are also known as bits in computer terminology. Using
binary system, the computer systems can store and process each type of data in terms of 0s and 1s only.
Example, the binary number 11001.101 represents the decimal value 25.625.
Octal system– The octal system is the positional number system that used base 8 to represent different values.
Therefore, this number system is also known as base-8 system. As this system uses base 8, eight symbols are a
available for representing the value in this system. These symbols are the digits 0 to 7.
Example, The octal number 215.43 represents the decimal value 141.5469.
Hexadecimal system– The hexadecimal system is a positional number system that uses base 16 to represent
different values. Therefore, this number system is known as base-16 system. As this system uses base 16, 16
symbols are available for representing the value in this system. These symbols are the digits 0-9 and the letters A, B,
C, D, E and F. The digits 0-9 are used to represent the decimal value 0 through 9 and The letters A, B, C, D, E and F
are used to represent the decimal value 10 through 15.
Example, the hexadecimal number 4A9.2B represents the decimal value 1193.1679.
(iii).Decimal to Hexadecimal conversion– The following example illustrate the method of converting decimal
number to its hexadecimal equivalent.
Digit→ 1 1 0 1
Positional value→ 23 22 21 2º
Decimal Number→ 1× 23 + 1×22 + 0×21 + 1× 2º
8 + 4 + 0 + 1 = (13)10
Therefore, (1101)2 = (13)10
(ii). Octal number to Decimal number conversion– The following example shows how to compute the decimal
equivalent of an octal number (257)8.
Digit→ 2 5 7
Positional value→ 83 82 81
Decimal Number→ 2× 82 + 5×81 + 7×80
128 + 40 + 7 = (175)10
Therefore, (257)8 = (175)10
Digital Logic 38 YCT
Search on TG: @apna_pdf
(iii). Hexadecimal Number to Decimal number conversion– The following example Shows how to compute the
decimal equivalent of an Hexadecimal (3A5)16.
Digit→ 3 A 5
Positional value→ 162 161 16º
Decimal Number→ 3× 162 + 10×161 + 5×160
768 + 160 + 5 = (933)10
Therefore, (3A5)16 = (933)10
Conversion from Binary number to Octal number and Vice-versa
(i) Binary number to Octal Number- Given a binary number, an equivalent octal number representation by 3
bits is computed by grouping 3 bits from right to left and replacing each 3-bit group by the corresponding octal
digit. In case number of bits in a binary number is not multiple of 3, then add required, number of 0s on most
significant position of the binary number
Example – Convert (10101100)2 to octal number.
Make group of 3-bits of the
given binary number (Right to left) 010 101 100
Write octal number for each 3- bit group. 2 5 4
Therefore, (10101100)2 = (254)8
(ii) Octal number to Binary number– Each octal digit is an encoding for a 3-digit binary number. Octal number
is converted to binary by replacing each octal digit by a group of three binary digits.
Example– Convert (705)8 to binary number.
Octal digit → 7 0 5
Write 3-bits binary
value for each digit → 111 000 101
Therefore, (705)8 = (111000101)2
Conversion from Binary number to Hexadecimal number and vice-versa
(i) Binary Number to Hexadecimal Number– Given a binary number, its equivalent hexadecimal number is
computed by making a group of 4 binary digits from right to left and substituting each 4-bit group by its
corresponding computed by making a group of 4 binary digits from right to left and substituting each 4-bit group
by its corresponding hexadecimal alphanumeric symbol. If required, add 0 bit on to have number of bit in a binary
number as multiple of 4.
Example– Convert (0110101100)2 to hexadecimal number.
Make group of 4-bits of
the given binary number (Right to left) 0001 1010 1100
Writ hexadecimal symbol for each group→1 A C
Therefore, (0110101100)2 = (1AC)16
(ii). Hexadecimal number to Binary number– Each hexadecimal symbol is an encoding for a 4-digit binary
number. Hence, the binary equivalent of a hexadecimal number is obtained by substituting 4-bit binary equivalent
of each hexadecimal digit and combining them together.
Example. Convert (23D)16 to binary number.
Hexadecimal digits→ 2 3 D
Write 4-bit binary for each digit→ 0010 0011 1101
Therefore, (23D)16 = (001000111101)2
Conversion from octal number to hexadecimal number
The given octal number can be converted' into its equivalent hexadecimal number in two different steps. Firstly,
We need to convert the given octal number into its binary equivalent. After obtaining the binary equivalent, we
need to making a group of 4 binary digits from Right to left and substituting each 4-bit group by its corresponding
hexadecimal alphanumeric symbol. In this type of conversion, we need to represent each digit in the octal number
to its equivalent 3-bit binary number.
Example– Convert the octal number (365)8 into its hexadecimal number.
Octal digits→ 3 6 5
Write 3-bits binary value
for each digit→ 011 110 101
Regrouping into 4-bits of
the binary number (Right to left)→ 0000 1111 0101
Write hexadecimal symbol
for each group→ 0 F 5
Therefore, (365)8=(F5)16
Digital Logic 39 YCT
Search on TG: @apna_pdf
Since the fractional part is 0, the multiplication is stopped. Write the integer part from top to bottom to get binary
number for the fractional part.
Therefore, (0.25)10 = (0.01)2
Example– Convert (0.675)10 to binary.
Since the fractional part (.400) is the repeating value in the calculation, the multiplication is stopped, write the
integer part from top to bottom to get binary number for the fractional part.
Therefore, (0.675)= = (0.1010110)2
(ii) Fractional part of Decimal number to Octal Number.
Example– Convert (0.625)10 to Octal Number.
Since the fractional part is 0, the multiplication is stopped, write the integer part from top to bottom to get octal
number for the fractional part .
Therefore, (0.625)10 = (0.50)8
(iii) Fractional part of Decimal number to hexadecimal number.
Since the fractional part (.800) is repeating, the multiplication is stopped, Write the integer part from top to bottom
to get hexadecimal equivalent for the fractional part.
Therefore, (0.675)10 = (0.AC)16
AND
OR
Universal Gate
NAND
Gate
NOR
Gate
MOSFET as
NOT Gate
Special Purpose Gates AND Gate is also called all or nothing gate
Gate Symbol Truth Table AND Gate works as a series switch
OR Gate is also called any or all Gate
EX- OR Gate works as a parallel switch
OR EX-OR gate acts as odd number of “1’s detector”.
EX-OR gate is used for even parity generator and
In EXOR operation
detector.
• For BUFFER
EX-OR gate is known as stair case switch.
CIRCUIT ⇒ Logic '0'
EX-NOR gate acts as even number of “1’s detector”.
• For INVERSION EX-NOR gate is used for odd parity generator.
CIRCUIT ⇒ Logic '1' XOR-Gate is also called anti-incidental logic gate.
EX- A ⊕ 0 = A → work as buffer
NOR
A ⊕ 1 = A → work as inverter
In EXNOR operation
• For BUFFER X-NOR-Gate is also called equivalence gate or
CIRCUIT ⇒ Logic '1' equality detector or co-incident logic gate.
• For INVERSION A ⊙ 0 = A → work as inverter
CIRCUIT ⇒ Logic '0' A ⊙ 1 = A → work as Buffer
NOR and NAND are special logic gates
Logic gates No. of NAND No. of NOR
Gate required Gate required A ⊕ B⊕C = A ⊙ B⊙C
NOT 1 1 A⊕A⊕A⊕ ………n times = 0, (if n = even)
= A, (if n = odd)
AND 2 3
OR 3 2 A⊙A⊙A⊙ …………n times = 1, (if n = even)
EX-OR 4 5 = A, (if n = odd)
EX-NOR 5 4 A⊕B= A⊕B= A⊙B A⊕B= A⊙B
NAND 1 4 A⊙B= A⊙B= A⊕B
NOR 4 1 Positive logic Negative logic Bubbled logic
Remember point AND- Gate OR- Gate NOR- Gate
OR- Gate AND- Gate NAND- Gate
NAND- Gate NOR- Gate OR- Gate
NOR- Gate NAND- Gate AND- Gate
Positive logic and Negative logic system
Positive logic
Logic ‘1’ voltage level is higher than logic ‘0’
voltage level
Digital Logic 44 YCT
Search on TG: @apna_pdf
Logic ‘0’ voltage level is lower than logic ‘1’ Karnaugh Map (K - Map]
voltage level A systematic & simple way of minimization of
Negative logic Boolean algebra.
Logic ‘0’ voltage level is higher than logic ‘1’ Minimization using K-map, the solution is not unique.
voltage level “Gray Code” is used in K-map.
Logic ‘1’ voltage level is lower than logic ‘0’ Number of cells = 2n, n = Number of variables.
voltage level Don’t Care - Considered when this is helping in
Representation of Boolean functions minimization of Boolean algebra.
Implicants = Number of minterms/maxterms
Prime implicants = Number of pairs
Essential Prime Implicants= Number of prime
implicants without redundant terms
n
Digital Logic Circuits
Maximum no. of Boolean expression or function = 2 2 Combinational Circuit Sequential Circuit
Sum of Product (SOP) : Each product term is Present output depends only Present output
known as minterm. SOP form (Σm) is used when on present input. depends on both
output is logic 1. Ex.- ( ABC ) + ( ABC ) + ( ABC ) present input as well
as past output.
Product of Sum (POS) : Each product term is
known as maxterm. POS form (ΠM) is used when No memory present. Memory is present.
output is logic ‘0’. Faster. Slower.
Ex.- ( A + B + C ) . ( A + B + C ) . ( A + B + C ) Easy to design. Harder to Design.
No feedback present. Feedback present.
Remember point No clock pulse required. Clock pulse required.
Maximum possible minterm or maxterm = 2n Arithmetic operation and Data storing system.
Maximum possible self dual function = 22
n –1
Boolean operation.
AND-OR logic = NAND-NAND logic (Used in Ex.- Adder, Substractor, Ex.- Flip-flop, Latch,
SOP). Decoder, Encoder, Comparator Counter, Register,
OR-AND Logic = NOR-NOR logic (Used in POS). MUX, D-MUX, parallel adder, serial adder etc.
ROM, RAM etc.
Combinational Circuits
Circuit Diagram Formula Implement by
Half Adder S = AB + AB = A ⊕ B • 5- NAND gates
C = A.B • 5- NOR gates
• 3- (2 × 1) MUX
• 2- (4×1) MUX
Full Adder S=A⊕B⊕C • 2- H.A+ 1 OR
= ABC + ABC + ABC + ABC gate
• 9- NAND gate
Co = ( A ⊕ B ) .C + AB • 9- NOR gate
• 7- (2 × 1) MUX
= AB + BC + CA
= AB + AC + BC
JK Qn+1 = JQn + KQ n
D Flip- Qn+1 = D
flop
T flip- Qn +1 = TQn + TQ n
flop
= T ⊕ Qn
Q Up-counter
Negative edge Q Down-counter
1
f CLK ≤
t pd (FF) + ( n – 2 ) t pd ( AND Gate )
1
f CLK ≤
t pd(FF) + t pd ( AND Gate ) If M = 1 up counter, If M = 0 down counter
Notation of ER Diagram
Student-
Stu_ID Stu_Name Proj_ID
Update anomalies– If data items are scattered and Project-
are not linked to each other properly, then it could Proj_ID Proj_Name
lead to strange situations. Third Normal Form
Deletion anomalies– We tried to delete a record,
For a relation to be in third normal form, it must be
but parts of it was left undeleted because of
in second normal form and the following must
unawareness, the data is also saved somewhere else. satisfy.
Insert anomalies– We tried to insert data in a No non-prime attribute is transitively dependent on
record that does not exist at all. prime key attribute.
Normalization is a method to remove all these Student_Detail–
anomalies and bring the database to a consistent
state.
Read ( A ) Write ( A )
Write ( A ) Read ( A )
Schedule S1 Schedule S2
2. Update Read–
T1 T2 T3 T1 T2 T3
Serializability in DBMS
Some non-serial schedules may lead to Write ( A ) Write ( A )
Write ( A )
Read ( A ) Write ( A )
inconsistency of the database. Serializability is Read ( A )
mainly of two types– ScheduleS1 Schedule S2
3. Final write–
T1 T2 T3 T1 T2 T3
Read ( A )
Write ( A ) Write ( A )
Re ad ( A )
Write ( A ) Write ( A )
|ω| ≤ n
(n + 2) state
Minimal DFA: ω ∈ {a, b}
Empty Language accepted: |ω| mod 2 = 0
In any DFA, if no final state exist, or final state are
L = {∈, aa, ab, ba, bb} aaaa, .....}
not reachable from initial state than the language
accepted by DFA is Empty Language.
In any DFA if initial state is also final state then '∈'
is also accepted by DFA.
Dead State: If any non-final state having self loop |ω| mod 2 = 1
on input symbol than that state is known as dead
state.
By reading any input, if automata in DFA and if we
don't reach to final state then that input is rejected.
|ω| mod 3 = 0
C-programming language = set of all valid program.
Program void main ( )
{
int a, b;
{ ≅ | ω | ≅ 1mod 3
|ω| mod n = 0
'n' length string
3→3
4→4
.
.
n→n
• Minimal DFA– ω ∈ {a, b}*
A Finite Automata is said to accept a language if all na(ω) = 2 (exactly two a's)
the strings in the language are accepted and all the
L = {aa, aba, baa, aab, ......}
string are rejected which are not presented in the
language.
DFA (Minimal)–
ω = {a, b}, |ω| ≤ 2 • na(ω) ≥ 2 (at least two a's)
L = {∈, a, b, aa, ab, ba, bb}
• ω ∈ {a, b}*
na(ω) mod 2 = 0
na(ω) ≅ 0 mod 2
|ω| = n |ω| ≥ n
(n + 2) state, (n + 1) state
Theory of Computation 67 YCT
Search on TG: @apna_pdf
• The language for which TM is possible know as
REL.
Note– FA → Finite Automata
PDA → Push Down Automata
CFL → Context-Free Language
CSL → Context Sensitive Language
TM → Turing Machine
REL → Recursively Enumerable Language
LBA → Linear Bounded Automata
• ω ∈ {a, b}*
na(ω) ≅ o mod 2
and
nb(ω) ≅ o mod 2
∈, aa, bb, aabb
abab Power Sequence = [TM > LBA > PDA > FA]
L=
baba ....... Expressive Power–
bbbb
• Number of language accepted by particular
na( ω) nb( ω) automata know as expressive power of that
even even ∈, aa, bb Automata.
even odd aab • It is important to note that DFA and NFA are of
odd odd ab same power because every NFA can be converted
odd even abb into DFA and every DFA can be converted into
Compliment of DFA– By interchanging final state NFA.
into non-final state and non-final state, then we can • The turning machine i.e. TM is more powerful
get the compliment of DFA.
than any other machine.
Minimization of DFA
Equivalent state- Two state q1 and q2 are equivalent
∨ x ∈ ∑ * both δ ( q1 , x ) and δ ( q 2 , x ) result either
• If language accepted by DFA is '1' then final state or non-final state otherwise they are not
compliment of DFA accept "Σ* – 1". equivalent.
• Compliment is applicable only for DFA. State Equivalence Algorithm– To detect equivalent
Note– We cannot get the compliment of NFA and e- state for two algorithm exist know as-
NFA.
• State equivalence algorithm
Chomskey Hirarchy–
• Marking algorithm
• Finite automata having one stack memory element
know as push down automata. There minimization algorithm application for only
• The comparison element remember the stack to for DFA (Non-applicable for NFA and ∈-NFA)
perform validation of string in push down After apply minimization algorithm for any DFA
automata. then the language accepted by DFA remains same.
• Hence language L2 is accepted by push down
Before apply minimization algorithm all not
automata but not finite automata.
reachable state one eliminated first.
• To accept language L3 finite automata phase and
push down automata phase hence turning machine Minimum Number of State of following–
is constructed.
• The language for which FA is possible know as
Regular language.
• The language for which PDA is possible know as
CFL.
• The Language for which LBA is possible know as
CSL.
Theory of Computation 68 YCT
Search on TG: @apna_pdf
Construction of NFA
1. Construct NFA that accept all string of a'b and b's
where each string ending with abab.
5. r1 + r2
Regular Expression
• The simplest way of represent regular languages
know as regular expression.
• Regular expression can be constructed by using 6. r1*
following '3' operand and input symbols as operands.
* → Kleene closer
+ → Union operator
. → Concatenation operation
7. r1+
1. L = { } φ
2. L = {∈} ∈
3. L = {a} a
4. L = {a, b} ab 8. φ+
5. L = (a, b) a + b
6. L = {∈, a, aa, aaa ......}a*
7. L = {a, aa, aaa ......}a+ Construct NFA for RE–
• For one regular language, there, may be possibility (a + b)* (aa + bb) (a + b)*
of having many regular expression by but one
regular expression represent only one regular
language only.
Identities of Regular Expression
1. R + φ = φ + R = R
2. R.φ = φ.R = φ
3. R.∈ = ∈.R = R
4. R* = (R*)* = (R+)* = (R*)+
5. RR* = R+ = R*R
6. R+ + ∈ = R*
7. a(ba)* = (ab)*a
8. a + b = b + a
9. ab ≠ ba
10. (a+b)* ≠ (ab)*
• Mealy– Mealy is mathematical model in which
11. (a+b)* ≠ (a*b*) output is associated with transition.
12. (a + b)* ≠ a* + b*
13. (a + b)* = (a* + b*)* = (a* + b)* = (a + b*)* =
(a*b*)*
14. ∈* = ∈; ∈+ = ∈
15. φ* = ∈, φ+ = φ
Theory of Computation 70 YCT
Search on TG: @apna_pdf
• Moore– Moore is mathematical model in which • Construct Mealy Machine that contain all the string
output is associated with state. of a's and b's and produces one as output if last two
symbol input are same otherwise produce.
Pumping Lemma
• Pumping Lemma is the theorem using to prove non-
regular language as non-regular.
• Pumping Lemma uses prove by contradiction
strategies.
•
Mealy Machine to Moore Machine Conversion–
Unambiguous Grammar
The grammar is said to be unambiguous for all string
(i) Normal form of CFG means applying condition
if the grammar exist only one parse tree or only one on RHS of the production.
LMD or one RMD or if one LMD and one RMD (ii) To normalize the grammar, it should be
ever exist but both produces the same parse tree. simplified.
1. a = b + c * d; (iii) There are mainly two normal forms known as
S → id/E Chomsky and Greibach normal form.
E → E + E/ E*E |id; GNF Normal Form– A → av*
E→E+E (a) Convert into GNF?
→E+E*E S → AB
→ id + E * E A → aA|bB|b
B→b
→ id + id*E
• The grammar is left recursive grammar, then
→ id + id * E
eliminate the left recursion to convert into GNF.
Inherently Ambiguous Grammar
Decision Properties of CFG–
• In ambiguous grammar from which elimination of
(i) Emptyness
ambiguity is not possible.
(ii) Finiteness Decidable
Example–The following language is inherently
(iii) Membership
ambiguous CFL Means, all of its grammar are
ambiguous and elimination of ambiguity is not (i) Emptyness– Checking whether CFG generate
possible for each grammar. empty language or not.
Theory of Computation 75 YCT
Search on TG: @apna_pdf
Algorithm– • PDA is only one type only, but recognize or are
(a) Eliminate useless variable from the given two types, DPDA, NDPDA.
grammar. Definition–
(b) Starting symbol is also useless then that grammar (i) There is only one type of PDA, that is language
generates empty language otherwise non-empty. recognizer (No output generator).
(ii) Finiteness problem– It means checking whether (ii) Expressive power of NPDA is more than
given CFG generates finite language or not. DPDA.
Algorithm– (iii) By default PDA means N-PDA.
(a) Convert the given grammar into CNF grammar. (iv) There are two type of acceptance methods to
(b) Construct CNF graph. accept a string in PDA, they are–
(iii) Membership Problem or Parsing Algorithm– • Empty Stack Method
(a) Checking whether string 'x' is generated from • Final State Method
given CFG or not.
(b) Checking whether given string is member of
{
Example– L = b n a n / n ≥ 1 }
given grammar or not, know as parsing. (a) Empty Stack Method– By reading the string
(c) The algorithm which performs parsing, know as from left to right, end of the string. If the stack is
parsing algorithm or membership algorithm. empty then the given string is accepted and irrelative
about number of final state.
Push Down Automata (PDA)
(b) Final State Method– By reading the starting
from left to right, end of the string, the PDA enters
into final state, then given string is accepted and
irrelative about stack symbol.
Parsing and Push Down Automata
(i) Top-Down Parsing– We present certain
techniques for top-down parsing which can be
applied to a certain subclass of context free
PDA(Q, Σ, q0, F, δ, z0, )
languages. We discuss LL(1) parsing, LL(K)
Q → Finite number of state
parsing, Left factoring and the technique to remove
Σ → Input alphabet left reversion.
q0 → Initial state (ii) Bottom up Parsing– In bottom-up parsing we
F → Set of final states have to reverse the productions to gets finally. This
z0 → Initial stack element suggests the following moves for a PDA acting as
δ → Transition function (a) δ(P, ∧ , αT) = {(P, A)| there exists a production
A → α}
Q × Σ ∪ {∈} × → Q × *
(b) δ ( P, σ, ∧ ) = {( P, σ )} for all σ in ∑ .
Process concept
Text Section– A process is more than the program
Operating system is one of the core software programs code, which is sometimes known as the text section.
that run on hardware and makes it usable. The user can It also includes the current activity, as represented
interact with hardware so that they can send commands by the value of the program counter.
and receive output. An operating system provides an Stack– The stack contains temporary data, such as
interface between user and machine. This interface can function parameters, returns addresses, and local
be Graphical User Interface (GUI) in which users. Click variables.
on screen elements to interact with operating system or Data Section– Contains the global variable.
a Command Line Interface (CLI) to tell the operating Heap– Dynamically allocated memory to process
system to do things, it also manages the computers
during its run time.
resource such as CPU, memory, disk drives and
printers. It provides services for application software.
Types of Operating System
Process state
anomaly.
page fault, the page is replaced which is not used Reference string:
frames.
Reference string:
Physical Structure
Types of connection– There are two possible
types of connection.
(a) Point-to-point connection– This connection
provides a dedicated link between two devices.
For example Television and remote control,
computer connected by telephone line.
Session layer This layer is responsible • Session Net BIOS, SAP Gateway phone,
(Layer 5) for the establishment of establishment, PPTP, ADSP, Servers
connection maintenance maintenance and RTCP, PAP,RPCP
of sessions, termination
authentication and also • Synchronization
ensures security. • Dialog controller
Transport The data in the • Segmentation and TCP, Firewall, Gateway
Layer transport layer is reassembly UDP,
(Layer 4) referred to as • Services point SPX
segments. It is addressing
responsible for the end • Message
to end delivery of the acknowledgement
complete message. The
transport layer also
provides the
acknowledgement of
the successful data
transmission and re-
transmits the data if an
error is found.
Network Layer It works for the • Routing IPv4, IPv6, ICMP, Router
(Layer 3) transmission of data • Logical Addressing IPSEC, MPLS Brouters
from one host to the • Subnet traffic
other located in control.
different networks. It
also takes care of
packet routing. the
sender and receiver's
IP addresses are placed
in the header by the
network layer
Data Link It is responsible for the • Framing PPP, ARP Frame, Switch
Layer (Layer node-to-node delivery • Physical addressing Relay, ATM, Fiber Bridge
2) of the message. The • Error control Cable etc. Access point
main function of this
• Flow control
layer is to make sure
data transfer is error • Access control
free from one node to
another, over the
physical layer, it
collects the packets to
from frames, which are
then transmitted over
the network.
Computer Network 106 YCT
Search on TG: @apna_pdf
Physical Layer It is responsible for • Bit synchronization RJ-45 100 Base Tx, Hub, NIC, Cable,
(Layer 1) transmitting individual • Bit rate control ISDN. Modem, wireless
bits from one node to • Physical topologies Repeaters
the next. When
• Transmission mode
receiving data, this
layer will get the signal
received and convert it
into 0s and 1s and send
them to the data link
layer. Which will put
the frame back
together
The Internet
Internet is two or more networks that can
transmit data with each other.
Back Backbones are large networks owned
bones by some communication companies
Verizon, AT & T, sprint etc.
MAN
• The ARP protocol is one of the auxiliary • Parity check code error detection is a linear
protocol defined in the network layer. It maps block code.
an IP address to a logical link address. ARP • Error detection technique is based on a binary
accepts IP address from the IP protocol maps division Cyclic Redundancy Check (CRC).
the address to the corresponding link layer • Cyclic Redundancy check is a subset of cyclic
address and pass to the data link layer. code (CRC) is used in network such as LAN,
• The data link layer is responsible to creation WAN. It is used to binary division error
and delivery of a frame to another node. It is detection technique.
responsible for packetizing (framing), flow • Checksum is an error detecting technique
control and error control, congestion control applied to a message of any length. Checksum
along the link. technique is used at the network and transport
• Link layer protocols three types of addresses layer rather than the data-link layer.
such as unicast, Multicast and broadcast. • Data link control (DLC) is connectionless or
Unicast– Address Unicasting one-to-one connection oriented. DLC is a net way and
communication. A frame unicast address transport layer protocol.
destination is destined only one entity in the • Data Link Control (DLC) is procedure for
link. Example A3:34:54:11:92:F1 It is communication between two adjacent nodes
separated by colons. such as node to node communication. Data link
Multicast address– Multicast address one-to- control function include control function
many communication. Example A2:34:45:11:92:F1 include framing and flow error control.
Computer Network 116 YCT
Search on TG: @apna_pdf
Connection less Protocol– Connectionless TDM– Time Division Multiplexing is requires
protocol frames are sent from one node to next the transmitter and receiver to be synchronized
without any relationship between the frames. periodically.
Frames are not numbered and there is no sense of Description
ordering. CSMA/CD CSMA/CD is reduce the possibility of
Connection Oriented Protocol– Connection- collision but it is not eliminate it.
oriented protocol is a logical connection Carrier Sense Multiple Access with
established between two nodes. Connection collision detection CSMA/CD
oriented protocol some point-to-point protocol. transmission and collision detection
Same wireless LAN, and some WAN. are continuous processes. We do not
Connection oriented protocol are rare in wired sent the entire frame and then look for
LAN. the collision. CSMA/CD as the media
access method Ethernet LAN as token
Protocol Description
passing, Token Ring, Token Bus.
PPP Point-to-point protocol provide the
CSMA/CA Carrier Sense Multiple Access with
services of physical layer. But to control
collision (CSMA/CA) is a wireless
and manage the transfer of data link
network. Collision are avoided through
layers. PPP does not provide any flow
the use of CSMA/CA three strategies
control. Error control is also limited to such as Inter frame space, contention
error detection. PPP uses a character window, acknowledgements.
oriented frame. It is a link layer protocol
such as link control protocol.
IEEEI 802 Standard for LANs (MAC)
HDLC High level Data Link Control (HDLC) is LLC-Logical Link Control MAC: Media Access
a bit oriented protocol for Control
communication over point-to-point and
Data-link layer Ethernet Token Ring Token
multipoint link. HDLC is a three types of
MAC MAC Bus
frames, information frame (I-frame),
MAC
supervisory frame (s-frames) and
Physical layer Ethernet Token Ring Token
unnumbered frames (u-frames).
Physical Physical Bus
Layer Layer Physical
Layer
Transmission media OSI or TCP/IP suite
Transmission media IEEE standard
• IEEE 802.16 standard for Wi-Max technology.
HUB
A hub is a device that operates only in the
physical layer. A repeater is a multiport device is
Media Access Control is a sub-layer in the data called hub. A hub or a repeater is a physical layer
link layer. device. Type of Hub- Active Hub, Passive Hub,
ALOHA– Aloha is random access method. It Intelligent Hub.
was designed for a radio (wireless) LAN, but it
can be used on any stared medium. The original
ALOHA protocol is called pure ALOHA. Pure
ALOHA is vulnerable time a station send frame.
Slotted ALOHA was invented to improve the
efficiency of pure ALOHA.
Computer Network 117 YCT
Search on TG: @apna_pdf
Routers 7 of OSI model. TLS is sometimes called SSL
A router is a three layer device operates in the (Secure Socket Layer).
physical layer. Data-link layer, network layer. A Fragmentation
router is an internetworking devices. A router
Fragmentation is a process divided packets into
change the link-layer addresses in a packet.
smaller pieces (fragments) so that resulting
pieces can travel across link smaller Maximum
Transaction Unit (MTU) that original packed
10 Gigabit
LAN size. The network layer fragmentation data when
the maximum size of a data gram exceeds the
Gigabit LAN
Gigabit LAN maximum size of data that can retained in a
Switch frame. There are three type of fragmentation.
Switch
External fragmentation, Internal fragmentation,
Data fragmentation.
...... ...... Firewalls
System System System System Firewalls provide protection against outside
cyber attackers by shielding your computer or
network from malicious or unnecessary network
Dynamic Host configuration Protocol
traffic. There is a two types of firewall.
(DHCP)– DHCP is an application layer program
i. Packet-Filter firewall– A packet-filter
using the client server helps TCP/IP at the
firewall is a router that uses a filtering table to
network layer. DHCP to assign permanent IP
decide packet must be discard (not forward). It is
address is the host and router.
based on network layer and transport layer.
Bridge ii. Proxy Firewall– A proxy firewall is a
A bridge operates data link layer. A bridge is a network security system that protect network
repeater add on functionality filtering by reading resource by filtering messages at the application
layer.
the MAC address source and destination. Bridge
is used inter connecting two LAN working same Routing → Routing Algorithms
protocols. i. Distance-vector Routing– DVR is used to
find the least cost (shortest distance) between
Gateway a source node (using the Bell man-ford
Gateways are protocol converters and operate at Equation).
any network layer. Gateways are generally more ii. Link state routing is select the best least-cost
complex than switch or routers. A gateway is route to transfer the data packets between the
also called protocol converter. sender/source and receiver/destination.
iii. Path-Vector-Routing is not actually used in
Tunneling
an internet and is mostly designed to route a
Tunneling is used in virtual private networks packet between ISP. Example BGP is a path
(VPNs). It can also setup efficient and source vector routing protocol.
connections between networks, enable the
Congestion Control
unsupported network protocol. A VPN is a Congestion control a number of packets send to
secure, encrypted connection over the public the network is greater than the capacity of the
shared network. VPN is a Transport Layer network. It can handle the number of packets a
Security (TLS) protocol operate layer 6 and layer network.
Computer Network 118 YCT
Search on TG: @apna_pdf
Cryptography Asymmetric key cryptography is a use to public
key and private key.
Cryptography is technique of securing
information and communication to achieve Electronic Email
message integrity and confidentiality and
Electronic mail allows users to exchange
exception. The cryptographic parameter client
messages. When the request arrives the server
and server a 48 byte master secret is created from
provides the service. Electronic mail is an on
the pre-master secret by applying two hash
way transaction.
function (SHA-1 and MDS).
Public key Email-Architecture
Public key cryptography is used for email traffic,
such as with the standard encryption method
S/MIME, for digital signatures as well as for
cryptographic protocol such as SSL/TLS, SSH
and HTTPS.
Secret key
Secret key cryptography is also called symmetric
cryptography because the same key is used to Protocol Description
both encryption and decryption the data. Secret SMTP Simple Mail Transfer Protocol is an
key crypto graphic include Advanced Encryption internet standard communication
Standard (AES). Triple Data Encryption protocol for electronic mail
Standard (3DES) and Rivest Cipher 4 (RC4). transmission message transfer agents
use SMTP to send and receive mail
Domain Name System
messages.
DNS is a host name for IP address translation
POP3 Post Office Protocol Version 3 (POP3)
service. It is application layer protocol for
provides access to an inbox stored in an
message exchange between clients and servers.
email server. It executes the down load
DNS is a distributed data base internet service
and delete operation for messages.
that translate domain name to IP address. TCP/IP
MIME Multipurpose Internet Mail Extensions
protocol use the IP address.
allows an e-mail message a non-ASCII
Electronic Email Security file such as a video image or a sound
Email security is the process of ensuring the and it provide mechanism transfer non
availability, integrity and authenticity of email text characters to text characters.
communication by protecting against the risk of IMAP4 Internet Message Mail Access Protocol,
email threats. version 4 is an application layer
Name Server protocol that operates for receiving
emails from mail server. Users have
Name server are work as a directory that
remote access to all the contexts.
translates domain names in to IP addresses.
Symmetric Key Cipher Domain Name System Resource Records
A symmetric key cipher uses the same key for Resource records are used to store data domain
both encryption and decryption. A key can be names and IP addresses. Each resource record
used for bidirectional communication. specifies information about particular object. The
Asymmetric key cryptography is based on server uses these records to answers queries for
applying mathematical function to the number. hosts in its zone.
Computer Network 119 YCT
10. PROGRAMMING IN
C and C++
A token is the smallest element of a program that Arithmetic Operators
is meaningful in the compiler. Arithmetic operators are used to perform
mathematical operations.
Operators Meaning of Operators
+ Addition, Adds two values
– Subtraction, Subtracts one value
from another
* Multiplication, Multiplies two
values
/ Division, Divides one value by
Identifier refers to name given to entities such as another
variables, functions, structures, array etc. % Remainder after division
Identifiers must be unique. ++ Increment, increase the value of a
Keywords is reserved word. It can't use as a variable by 1
variable name and constant name. –– Decrement, Decreases the value of a
auto break case char variable by 1
const double else continue
Relational Operators
default do enum extern
float for goto if Relational Operators are used to checks the
int long register return relationship between two operands.
Special Characters
Special symbols have some special meaning and
they can't be used for other purposes.
For Loop
Syntax:
Symbol Meaning Symbol Meaning
for(init statement; testexpression; updatestatement)
~ Tilde / Slash {
# Pound sign | vertical bar //body of loop
$ Dollar sign \ back slash }
Programming in C & C++ 121 YCT
Search on TG: @apna_pdf
How for loop works: Syntax–
for(init;condition;increment){
for(init;condition;increment){
//statement of inside loop
}
//statement of outer loop
}
Flow-Chart of Nested for Loop
Flow-Chart of Program
2. If-else statement–
Syntax–
if(condition){
//execute block if condition true
}else{
//execute if condition false
}
Flow-Chart of if-else
4. If-else ladder–
2. Continue statement
Syntax–
if(test expression){ Syntax–
//statement Continue;
} else if { Flow-Chart of continue
//statement
}
else if{//statement
}
.
.
.
else{//statement
}
Flow-Chart of Ladder if -else
Jump Statements
It is used to interrupt the flow of the program or
escape a particular section of the program.
Programming in C & C++ 124 YCT
Search on TG: @apna_pdf
Example– return 0;
int main(){ }
int myFirstIndex[] = {25, 40, 70, 150}; Output: 2
printf("%d", myFirstIndex[0]); 3
return 0; 4
} 5
output = 25 6
Array in Loop– 8
Example– Strings– Strings are used for storing
int main() text/characters.
{
int arr [] = {5, 10, 15, 17, 20};
int i = 0;
while (i < 5)
{
printf("%d", arr[i]);
'\0'
i++;
}
return 0;
C[0] C[1] C[2]
}
Output = 5 10 15 17 20 a b \0
Example–
#include <iostream>
using namespace std.;
class implement abstraction {
Class– A class can be considered a container private:
containing data variables and functions. int a, b;
Human Being as a class– public;
void set (int x, int y){
a = x;
b = y;
}
void display(){
cout << "a=" <<a<<endl
cout << "b=" <<b<<endl
}
};
int main(){
implement abstraction obj;
Object– Objects are the instances of the class.
When a class is defined, no memory is allocated obj.set(10, 20);
but when it is instantiated memory is allocated. obj.display();
Class person{ return θ;
char name [30]; }
int id; Output– a = 10
public: b = 20
void getdetails(){} Inheritance– Inheriting features from a base
}; class into a derived class.
int main(){ The class which inherits/takes the features in
person p1;//p1 is a boject. known as the derived class and the class whose
} features if inherited is called the base class.
Programming in C & C++ 130 YCT
Search on TG: @apna_pdf
Example–
Input text
Chennai
object oriented programming
New city name: Chennai
Output–
Second run
object oriented programming
Enter city name:
Number of characters = 27
New Delhi
When we type a line of input, the text is sent to
City name: New
the program as soon as we press the RETURN
key. The program, reads are characters at a time
Enter city name again:
using the statement cin.get(c); and displays it
City name now: Delhi
using the statement cout.pute(c);. The process is
terminated when the newline character is
Enter another city name:
encountered.
Greater Bombay
getline() and write() function– We can read and
New City Name: Greater Bombay.
display a line of text more efficiently using the
line oriented input/output function getline() and Formatted Console I/O Operations
write(). The getline() function reads a whole line Formatting the output these features include.
of text that ends with a newline character. This • iOS class functions and flags
function can be invoked by using the object cin. • Manipulators
cin.getline(line, size); • User defined output functions
Programming in C & C++ 138 YCT
Search on TG: @apna_pdf
Functions Task }
width() To specify the required field ostream & form (ostream & output){
size for displaying an output output.setf(ios:: showpos);
value output.setf(iso:: showpoint);
precision() To specify the number of digits output.fill('*');
to be displayed after the output.precision(2);
decimal point of a float value output.<<setiosflags(ios::fixed)
fill() To specify a character that is <<setw(10);
used to fill the unused portion return output;
of a field }
setf() To specify format flags that int main(){
can control the form of output cout<<currency << form << 7864.5;
display return 0;
Unsetf() To clear the flags specified }
any data file. The updating would include one or has occurred. If it is false, it may be
more of the following tasks. possible to recover from any other
• Displaying the contents of a file error reported and continue operation.
• Modifying an existing item good() Return true if no error has occurred.
• Adding a new item This means, all the above functions
• Deleting an existing item. are false. For instance, if file.good() is
This can be easily implemented if the file true, all is well with the stream file
contains a collection of items/objects of lengths.
and we can proceed to perform I/O
In such cases, the size of each object. Can be
operation when it returns false, no
obtained using the statement.
further operations can be carried out.
int object_length=sizeof(object);
Programming in C & C++ 141 YCT
XML was designed to carry data with focus on Status– It contains the http response code string
what data is. from server.
HTML was designed to display data with focus StatusText– It contains the http response string
on how data looks. from the server.responseText. It contains the
XML tags are not predefined like HTML tags response in text format from the server.
are. responseXML– It contains the response XML
In XML all elements must have a closing tag. from server.
XML tags are case sensitive. getAllResponseHeaders– It returns all the
XML Declaration– XML declaration is not a headers name as string.
tag. It is used for the transmission of the meta OverrideMimeType– It is used to set the mime
data of a document. type which is used to treat the response data type
Syntax– to be treated as text or XML type.
<?xml version = "1.0" encoding = "UTF-8"?> DTD– DTD stands for Document Type
This line represents the XML prolog or XML Definition. DTD defines the structure and the
declaration. The XML prolog is optional. It if legal elements and attributes of an XML
exists, it must come first in the document. document.
Syntax–
1. Export variable_name = value;
2. Variable_name = value;
Execution of Servlets–
export {variable_name}
1. The clients send the request to the web server.
Java 2. The web server receives the request.
Java was developed by James Gosling at 3. The web server passes the request to the
SunMicro system in the year 1995, later acquired corresponding servlet.
by oracle corporation. It is a simple 4. Servlet process the request and generates the
programming language. Java is an object response in the form of output.
oriented programming language with its runtime 5. The servlet sends the response back to the web
environment. It is combination of features of C server.
and C++ with some essential additional concepts. 6. The web server sends the response back to the
client and the client browser displays it on the
screen.
Applets
An Applet is a java program that can be
embedded into a web page. It runs inside the web
browser and works at client side. An Applet is
embedded in HTML page using the APPLET or
OBJECT tag and hosted on a web server. Applet
are used to make the website more dynamic and
entertaining.
Lifecycle of Applet
Servlets
Servlet is a server side java program module that
handles client requests and implements the
servlet interface. Servlets can respond to any
type of request and they are commonly used to
extend the application hosted by web servers.
Servlet is a web component that is deployed on
the server to create a dynamic page.
When an Applet begins, the following methods
Properties of servlets are as follows– Servlets are called in this sequence.
work on the server side. Servlets are capable of 1. init()
handling complex requests obtained from the 2. start()
web server. 3. paint()
index() Returns the index of the first difference() Returns a set containing the
element with the specified value difference between two or
more sets
insert() Adds an element at the specified
differecne_update() Remove the items in this
position
set that are also included in
pop() Removes the element at the
another, specified set
specified
remove() Removes the item with the pop() Removes an element from
specified value the set
reverse() Reverses the order of the list remove() Remove the specified
sort() Sorts the list element
Tuple– Tuples are used to store multiple items in union() Return a set containing the
a single variable. A tuple is a collection which is union of sets
ordered and unchangeable and tuples are written
update() Update the set with the
with round brackets. Tuple items are indexed the
first item has index [0] and second index[1]. union of this set and others
in your application. A file with the file extension using RegEx can be used to match against a
.py. string.
Iterators in Python–
How to use Module and Variable– The module
An iterator is an object that implements the
we just created by using the import statement.
iterator protocol. In other words, an iterator is an
Module create variables of all types (arrays,
object that implements the following methods:
dictionaries, objects).
__iter__ - It returns the iterator object itself.
Example–
__next__ - It returns the next element.
file name mymodule.py Generators in Python–
Stage 6
Spiral model has four phases:- model focuses more on flexibility rather than on
requirement while developing any product. New
features can be added easily in this model.
Agile does not rush the team to deploy the
product to customers but to perform testing at
the end of each sprint.
In order to
p
M
C
by gathering
Actualrework efforts
7. Rework effort ratio × 100
Totalactualefforts
Defects accepted
8. Accepted defects × 100
Total defects
The above list of focus areas that can tackle the broad
upsides of the software project management and by
Down sides of Software Project Management
(1)
Basic model KLOC model a1 a2 b1 b2
a2
E=a1(KLOC) P.M (2-50) Organic 2.4 1.05 2.5 0.38
(2)
Example– 1=> Solution- The most appropriate mode for 200 KLOC is
semi-detached mode.
Suppose a project was estimated to be 400 KLOC.
Hence, E=3.0(200)1.12=1133.12 PM
Calculate the effort and development time for each of the
Solution- E
Average staff size (ss) = Persons.
D
(i) Organic mode,
1133.12
E=a1*(KLOC)a2 PM = 29.3
D=b1(E)b2.M KLOC
Productivity =
E
D=2.5*(1295.31)0.38=38.07 PM
200
=
(ii) Semi-detached mode, 1133.12
= 0.1765 KLOC / PM
E=3.0*(400)1.12=2462.79 PM
Productivity = 176 LOC/PM
D=2.5*(2462.79)0.35=38.45 PM
The following figure shows a plot of estimated effort
(iii) Embedded mode,
versus product size.
E=3.6*(400)1.20=4772.81 PM
D=2.5*(4772.8)0.32=38 Pm
Example– 2=>
Gantt Chart
It shows the project schedule with respect to time period which was devised by Henry Gantt in 1917. It is also
known as a horizontal bar chart which represents activities and time schedule for the project.
Duration 3 3 3 3 1
2 + 4 × 4 + 12 30
teof A = = =5
6 6
10 + 4 × 12 + 26 84
teof B = = = 14
6 6
Variance (σ)=> It is the variance of activity given by the 8 + 4 × 9 + 10 54
teof C = = =9
following formula:- 6 6
10 + 4 × 15 + 20 90
(tp − to)2
2 teof D = = = 15
σ = [(tp − to) / 6] =
2
6 6
36
7 + 4 × 7.5 + 11 48
Example– teof E = = =8
6 6
The following characteristics have eight activities 9 + 4×9 + 9 54
teof F = = =9
(A, B, C, D, E, F, G and H) of a small project:- 6 6
Software Engineering 171 YCT
Search on TG: @apna_pdf
3 + 4 × 3.5 + 7 24 The critical path of the project is 1-2-3-4-5-6,
teof G = = =4 critical activity being A ,D ,G and H.
6 6
The expected project is the sum of duration of each
5 + 4×5 + 5 30
teof H = = =5 critical activity =5+15+4+5=29 weeks.
6 6
25 25 4
Variance of project= + + +0 =6
9 9 9
Latest
Earliest Time
Activity σ Time
Start Finish Start Finish
A 25/9 0 5 0 5 Correctness- As per the need of the user, software
B 64/9 0 14 1 15 design should be correct.
Completeness- The design should be complete like
C 1/9 5 14 6 15 modules, external interfaces and data structures.
Flexibility- As per the need, it should be flexible to
D 25/9 5 20 5 20 modify or alter.
E 4/9 5 13 16 24 Efficiency- All resources should be used by the program
with efficient.
F 0 14 23 15 24 Consistency- The consistency should be maintain in the
design.
G 4/9 20 24 20 24 Maintainability- The design should be so simple in
order that it can be easily maintainable by other
H 0 24 29 24 29
designers.
Software Engineering 172 YCT
Search on TG: @apna_pdf
Software Design Levels / Metrics
There are many software design levels of which we
can divide into three main categories. These are;-
Architectural Design- This first level design is highest Objects- It inherits a class's attributes and operations
summarize edition of the system that determines the involved in solution design. For an instance, banks,
software or application as a method with more elements company, person and users are considered as objects.
interactive with each where the designers obtain the idea
Classes- These are generic descriptions of objects which
or thought of a suggested domain or province. It chooses
are class instances that define all the properties and
the overall structure and ignores the internal details.
methods. A Class encapsulates the data and procedural
High-Level Design- This second level design represents
abstractions described by attributes. A super class is
multiple components and cooperation with each. It is an
generally a set of classes from where both attributes and
identification of modular arrangement, different modules
operations can be inherited by a sub class.
and relationship among them. This design also defines
Messages- Massages consist of the integrity of the goal
the interface among each module. High Level Design is
object that is the name of requested operation and action
also known as preliminary design like a tree diagram
needed to. complete the function. All objects are
called the structure chart.
communicated by massage passing.
Detailed Design- This third level design determines the
Abstraction- Abstraction handles the complexity in
logical structure, data structure and algorithms of the
object oriented design. It is also the removal of the
different modules in comparison to previous module
unnecessary and amplification of the essentials.
designs and implementations. The accomplishment part
which will be finally seen by the system, dealt with this Encapsulation- Encapsulation is also known as
detailed design. information hiding concept or concealing. The data and
operations are tied to a single unit. It not only bundles or
Function Oriented Design groups a vital information of an object together but also
How the module should be interconnected and restricts access to the operation, method and data from
needed for the system based on SRS (Software the out access to the operation, method and data from the
Requirement Specification) are focused by the function outsider world.
oriented design. In this approach or method, the design is Inheritance- To be staked hierarchically, OOD permits
decomposed into a set of interacting units which have similar classes, where lower or sub classes can be
clearly defined by the following categories:- implemented, imported, reused variables and functions
from their immediate super classes. This OOD's
characteristics is called an inheritance because it makes
its easier to define and create a specific and generalized
classes respectively.
Polymorphism- Polymorphism provides a program the
Object Oriented Design ability to redefine techniques for derived classes. It
Object Oriented Design (OOD) is the process in permits a specific routine to uses different types of
which the system is viewed as a group of entities or variables at different times. Polymorphism is a feature /
objects. This process permits the creation of a software technique or mechanism where similar tasks or functions
solution based on object notion. Each object handles its performed depending.
state data among them, and responsible for its own data. upon how the service is invoked, then the respective
In other words, every object belongs to a class. portion of code gets executed.
Software Engineering 173 YCT
Search on TG: @apna_pdf
User Interface Design By using coding standards, our code will be easily
understandable, easy debugging, error-free according
The user interface is the frontend application view or
to needs.
the visual part of an application or operation system
The coding standards are the guidelines or rules how to
through which any user interacts with a computer or
write the code so that overall coding becomes
software in order to use software. How commands are
understandable.
given to computer or software and how data are
displayed on the screen are determined by interface The programmer should use-
design which is mainly of two types:- → Less global variable
→ Exception handling mechanism
Text Based User Interface or Command
→ Naming convention for global and local
Line Interface variable or constant.
It provides a command prompt, where the user types → Comments for better understanding.
the predefined commands in their syntaxed order. The → Maximum 1 to 20 line of code in a phase.
predefined commands are needed to be remembered by → Very clever or easy code.
the users. It is also known as Command User Interface → Different identifier for multiple purpose.
(CUI).
→ Name of variable and method not in short
Graphical User Interface form.
It provides the simple interactive interface to the Goals of Coding
users to interact with the system. Using GUI, users
interpret the software because GUI can be a group or
combination of both hardware and software. To reduce the cost To translate the design into a
of later phases. computer language format.
In this testing, the developer feeds the input and errors and defects are discovered in the system.
measures the output because this testing is the last 2. The amount of time or the Mean Time to Defect
testing done by the developer side just before the (MTTD) are discovered prior to and after delivery to
delivery of the product. the customer between bugs or errors.
Software Engineering 175 YCT
Search on TG: @apna_pdf
Having fewer errors, bugs, defects, a higher MTTD is Reliability Testing or Software Testing
associated generally with better overall quality.
Reliability tests are designed to measure the ability
The software quality assurance is an umbrella of system to remain operation for long period of
activity for checking the quality of software time.
whether the software we are making is quality full
It is typically expressed in terms of Mean Time to
or not.
Failure (MTTF).
Software Reliability The average of all time intervals between successive
It is a probability of failure-free software operation failure is called the MTTF.
for a specified period of time within particular After a failure is observed, the developers analyze
environment. It is a dynamic system characteristics or and fix the defects or bugs that consumes
execution event. sometimes, it is called the Repair Time.
The failure of software depends on two factors-
Types of Reliability Testing
1. No. of faults being evaluated in software.
2. Operational profile of execution of the software.
Types of Time
1. Execution Time- The actual CPU time that the
software takes during its execution.
2. Calendar Time- Normal or regular time that we use
on a daily basis.
3. Clock Time- Actual time that is elapsed while the
software is executing. This time also includes the
time that the software spends while waiting in the
system.
1. Transient Failure- It occurs only with particular ⇒ It involves subjecting the system
4. Stress
inputs. to high levels of usage to identify
Testing
performance that can cause the
2. Permanent Failure- It appears on all inputs. system to fail.
3. Recoverable Failure- It can be recovered by the
⇒ It involves running the system
system without operator's help. continuously for an extended
5. Endurance
4. Unrecoverable Failure- It can be recovered by the Testing period of time to identify issues
such as memory leaks.
system with operator's help only.
⇒ It involves subjecting to system
5. Non-corruption Failure- This failure doesn't corrupt to sudden, unexpected increases
6. Spike in load or usage to identify
system's data or state.
Testing performance, that can cause system
6. Corrupting Failure- This failure damages the
to fail.
system's data or state.
Predictive Modeling- It is a statistical technique Mean Time Between Failure (MTBF)- It measures
using machine learning and data mining. It is used to the reliability testing in terms of mean time between
effort and costs in forecasting. Mean Time to Failure (MTTF)- It is the time
between two consecutive failures.
Estimation Modeling- It is a technique which is used
Mean Time to Repair (MTTR)- It is known as the
to find out the cost estimates to develop and test
software algorithm, equations, etc. time taken to fix the failure.
1
4. Occurrence Rate of Failure
Mean Time to Failure(MTTF)
Number of Failures
5. Probability of Failure
Totalcasesconsidered
Example- Find out the calculation of Mean Time to It helps the system upgrade process to be straight-
Failure (MTTF), where the total time and the number of forwarded.
unit tested are needed.
Greater productivity is given by system efficiency and
Solution-If the values are as below, the Mean Time to
higher performance.
Failure (MTTF) is calculated as:-
Totaltime Clean Room Approach
MTTF =
Number of units tested This approach was first proposed by Mills, Dyer and
100 Linger during the 1980s.
= = 2.5
40 In software engineering, clean room is an approach
Advantage of Software Reliability to produce quality software. It follows a set of principles
It is used for data preservation. and practices for gathering needs, designing, testing,
It helps to avoid software failure coding, managing, etc which improves the quality of the
This method consists of many diagrams as class, textual and structural methods were formulated by Ivar
object, state transition, module, process and interaction. Jacobson in 1986.
It is an approach very friendly and easy With a clear flow of events to follow, text is easy to
methodology used to develop manageable object- read.
oriented because it is the closet to the traditional
Formal style using pseudo code.
approach. Rumbaugh method is also known as OMT
(Object Modeling Technique) used in the real world for It governs interaction between the various actors.
designing and modeling of software. OMT includes the How and when the use case begins and ends.
four stages (analysis, designing system, designing object
How and when of data storage and usage ends.
and implementation).
Additionally, OMT is always broken down into How the constraints of the problem domain are
three different parts or models (object, dynamic, handled.
functional). These three models are similar to traditional
Example- Lets illustrate a Jacobson method ordering
system.
Example- Lets illustrate a Rumbaugh diagram related to kiosk system, which relies on the customer for order
a Bank-Account having the transaction between
same as the receipt relies on the kiosk for order:-
customer and Bank Account:-
If any user uses an online service to send emails, Cloud computing provides more options for
documents, watch movies, listen to music, send people and business as cost savings, increase
pictures, play games then these all are made possible productivity, speed and efficiency, performance
behind the scene by cloud computing. It generally used and security that are benefits for users.
to store, backup and recover data. By using the Example of cloud computing - Google Drive,
following you can - One Drive, Box or Dropbox, etc.
Features of Cloud
There are many cloud features–
Types of Cloud Computing Public Cloud - This service is sold on-demand by the
minute or hour through long-term commitments because
Private Cloud - A private cloud is the service and a third-party CSP (Cloud Service Provider) provides the
infrastructure that are maintained on a private network, service over the internet. In this cloud, all hardware,
because it refers resources that can be physically located software, servers, storage and other infrastructure are
on the company's or organization's on-site data center. owned and managed by the CSP.
Rarely, even some organizations pay third-party service Hybrid Cloud - A hybrid cloud is the combination of
to be built and hosted by private cloud. public cloud and private cloud services. It is used to
On Premises or
IaaS PaaS SaaS
On-site
■Services are highly scalable, dynamic, flexible. Customer Relationship Management (CRM)
applications
■ GUI and API based access.
Characteristics of SaaS-
■ Automated administrative tasks.
■ Updation are applied automatically so users
2. PaaS (Platform as a Service)- are not responsible for hardware and software
It is a created platform for the programmers updates.
to develop, test, run and manage the applications,
■ Managed from a central location.
so that users can access these tools over the
internet using APIs, web portals or gateway
■ Hosted on a remote server.
software. PaaS offers runtime environment for ■ Accessible over the internet.
applications to be developed. It has a feature of ■ The services are purchased on the pay-as-per-
point-and-click tool that enables non-developers use basis.
to create web applications. Virtualization-
Example- Windows Azure, Heroku, Force.com, It is a creation or technique of a virtual (rather
Google App Engine, Apache Stratos, AWS than actual) version of something such as a
Elastic Beanstalk, Magento Commerce Cloud server, a desktop, a storage device (RAM), an
and OpenShift, etc. operating system or network resources which
Characteristics of PaaS- allow to share a single physical instance.
■ Integrates with web services and databases. Creating a virtual machine over existing
■ Accessible to various users via the same operating system and hardware is known as
Complicated ESX/ESXi,
Security
Management Oracle VM,
Microsoft
Resource over
Price Hyper-V, Lynx
allocation
Secure
2. Type 2 Hypervisor- It is also called hosted
hypervisor which is installed and run inside the
physical host machine's operating system. It is
found in environments with a small number of
For the efficient execution, grid computing breaks down
servers.
each task into small fragments and each fragment is
Pros Cons Example processed parallel. For example.
Less flexible A = (4 × 7) + (3 × 8) + (2 × 9)
Easy to manage
resource Oracle VM Step 1: A = 28 + (3 × 8) + (2 × 9)
management VirtualBox, Step 2: A = 28 + 24 + (2 × 9)
Step 3: A = 28 + 24 + 18
Convenient for VMware
Performance Step 4: A = 70
testing Workstation
Advantages of Grid Computing-
Allows access Pro/ VMware
All machines with various operating systems can
to additional Fusion
Security use a single grid computing network.
productivity Across different physical locations, the tasks can
tools be done or processed parallel while users don't
have to pay money for them.
GRID COMPUTING Servers are not needed because it is not
To accomplish a joint task, a grid is made up of a centralized.
Disadvantages of Grid Computing
number of resources and layers or distributed
For some applications, licensing may make it
architecture of various computers connected by
restrictive.
networks. On a network, all machines collaborate Many groups are reluctant with sharing
under a common protocol because all tasks are resources.
difficult for a single machine to handle. The grid software is still in the involution stage.
Types of Clustering
through internet. The word "Beowulf" is originated algorithm. MapReduce performs the
from an old English poem having the same name. A distributed processing in parallel in a hadoop
group of identical and commodity grade computers cluster to work so fast. It has only two phases
is called Beowulf cluster. This cluster differs from namely Map and Reduce that are utilized. Any
others in its behaviour of working on many big data are inputted, they go through Map and
operating systems- Reduce phases until they got executed in
Kerrighed output form. Map function breaks the data
MOSIX blocks (big data input) into tuples which works
Rocks Cluster Distribution function combines the tuples into set of tuples
characteristics-
A private network with dedicated processors, and
easy replication for multiple vendors.
It is a free and open source software scalable
with Input-Output and no custom components.
It is an Apache open source framework. It is
written in java that allows distributed execution
using programming models. The hadoop's Map function does many tasks as
environment provides distributed storage and RecordReader, Combiner, Partitionar, etc and
computation across computer clusters. By the help Reduce function also does many tasks as
of two major layers, it is designed to scale up from shuffle and sort, Reduce and Produce output
a single server to thousands of servers. Its two format.
layers are –
2. HDFS- HDFS stands for Hadoop Distributed
(i) Computation/processing layer (MapReduce)
File System. It works on commodity hardware
(ii) Storage layer (HDFS)
and utilizes storage permission. It is used to
The main purpose of hadoop is, it utilizes a large
cluster of commodity hardware to keep and store store data in large chunk of blocks to the
programming algorithm. For example- Yahoo, (a) NameNode (Master)- It is used to guide
Facebook, eBay, Netflix are using hadoop in their the Datanode (slaves) because it works as a
organization to deal with big data. master in Hadoop cluster.
Cloud Computing 190 YCT
Search on TG: @apna_pdf
(b) DataNode (Slaves)- It is used to utilize or Oozie
store the data in Hadoop cluster because it
It is a Java web application used to schedule
works as a Datanode.
hadoop jobs. Multiple jobs are combined
3. YARN- It is a framework on which sequentially into one logical unit of tasks by
MapReduce works. YARN works two oozie. For Hadoop, oozie is a workflow scheduler
operations- Job Scheduling and Resource that permits users to create Directed Acyclic
Management. Job scheduler divides a big task Graphs of workflow.
into small jobs and Resource management Oozie consists of two parts:-
manages all the resources that are made (a) Workflow engine- It is responsible to run
available for running Hadoop cluster. YARN and store workflows of Hadoop jobs as
performs its tasks by using many features- MapReduce, Hive and Pig. If workflow
as Multi- Tenacy, Scalability, Compatibility engine specify a sequence of actions to
and cluster Utility. execute, then workflow job has to wait.
4. Hadoop Common- It is also known as (b) Coordinator engine- Based on predefined
common utility used by HDFS, MapReduce schedules and data availability, coordinator
and YARN. Hadoop common utilities are Java engine runs workflow jobs.
files or Java library or Java script needed for
other components. It solves the hardware
failure if it occurs in hadoop framework.
Advantages of Hodoop
Hadoop has an ability to store large amount of
data.
Hadoop has high flexibility and high
computational power.
Hadoop's tasks are independent i.e. open source.
Oozie can manage the lifecycle of the jobs and
It has linear scaling. timely execution of thousands of workflows.
Disadvantage of Hadoop Anyone can easily start, stop, suspend
Hadoop is not more effective for small data. (terminate) and re-run the jobs as oozie is very
Hadoop has hard cluster management and much flexible and it has command line interface
learning liabrary that is called Mahout. largely self serve in nature. Low touch model is
In other words, to support the customers through To deliver value on automation tools, heavy
model, a human first method is used. It is often Executing task and accomplishing goals can
navigate a complex process. It includes in- High, Low, No-Touch Partner Program
person-meeting, webinars, video chat, demos and
Segmentation
phone calls, etc.
Little to no human interruption during on- customer service. On the other hand, when
To deliver value on automation tools, heavy with customers, it is called low touch customer
Executing task and accomplishing goals can company uses automation to digitally engage, it