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

w

DEPARTMENT OF ARTIFICIAL INTELLIGENCE


AND MACHINE LEARNING

Design and Analysis of Algorithm Laboratory


Course Code:21AIL47A
Lab Manual

Academic Year:2022-2023
BATCH: 2021 – 2025
YEAR: II
SEMESTER: IV

Lab-Coordinator: Mrs.Sonia Maria D’Souza


Mrs Gurupriya M
INSTITUTION

Vision

To emerge as an institute of eminence in the fields of engineering, technology and management


in serving the industry and the nation by empowering students with a high degree of technical,
managerial and practical competence.

Mission

To strengthen the theoretical, practical and ethical dimensions of the learning process by
fostering a culture of research and innovation among faculty members and students.
To encourage long-term interaction between the academia and industry through their
involvement in the design of curriculum and its hands-on implementation.
To strengthen and mould students in professional, ethical, social and environmental dimensions
by encouraging participation in co-curricular and extracurricular activities.
To develop value based socially responsible professionals for the betterment of the society

Quality Policy

To emerge as an institute of eminence in the fields of engineering, technology and management


in serving the industry and the nation by empowering students with a high degree of technical,
managerial and practical competence.

Values

❖ Academic Freedom ❖ Professionalism

❖ Innovation ❖ Inclusiveness

❖ Integrity ❖ Social Responsibility


DEPARTMENT of AI & ML

Vision

To develop an outstanding AI and ML professionals with profound practical, research &


managerial skills to meet ever changing Industrial Social and Technological needs of the Society

Mission

To disseminate strong theoretical and practical exposure to meet the emerging trends in the
industry.
To promote a freethinking environment with innovative research and teaching-learning
pedagogy.

To develop value based socially responsible professionals with high degree of leadership skills
will support for betterment of the society.

Program Educational Objectives (PEOs)

Develop and excel in their chosen profession on technical front and progress
PEO1 towards advanced continuing education or Inter-disciplinary Research and
Entrepreneurship
Become a reputed innovative solution provider- to complex system problems or
PEO2 towards research or challenges relevant to Artificial Intelligence and Machine
learning
Progress as skilled team members achieving leadership qualities with trust and
PEO3 professional ethics, pro-active citizens for progress and overall welfare of the
society
Program Specific Outcomes (PSOs)

A graduate of the Computer Engineering Program will demonstrate

PSO1: Develop models in Data Science, Machine learning, Deep learning and Bigdata

technologies, using acquired AI knowledge and modern tools.

PSO2: Formulate solutions for interdisciplinary problems through acquired programming

knowledge in the respective domains complying with real-time constraints.

Program Outcomes (POs)


PO1 Engineering knowledge: Apply the knowledge of mathematics, science, Engineering

fundamentals, and an Engineering specialization to the solution of complex

Engineering problems in Computer Engineering.

PO2 Problem analysis: Identify, formulate, review research literature, and analyze

complex Engineering problems in Computer Engineering reaching substantiated

conclusions using first principles of mathematics, natural sciences, and Engineering

sciences.

PO3 Design / Development of Solutions: Design solutions for complex Engineering

problems and design system components or processes of Computer Engineering that

meet the specified needs with appropriate consideration for the public health and

safety, and the cultural, societal, and Environmental considerations.


PO4 Conduct Investigations of Complex Problems: Use research-based knowledge and

research methods including design of experiments in Computer Engineering, analysis

and interpretation of data, and synthesis of the information to provide valid

conclusions.

PO5 Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and

modern Engineering and IT tools including prediction and modeling to complex

Engineering activities in Computer Engineering with an understanding of the

limitations.

PO6 The Engineer and Society: Apply reasoning informed by the contextual knowledge

to assess societal, health, safety, legal and cultural issues and the consequent

responsibilities relevant to the professional engineering practice in Computer

Engineering.

PO7 Environment and Sustainability: Understand the impact of the professional

Engineering solutions of Computer Engineering in societal and Environmental

contexts, demonstrate the knowledge of, and need for sustainable development.

PO8 Ethics: Apply ethical principles and commit to professional ethics, responsibilities,

and norms of the Engineering practice.

PO9 Individual and Team Work: Function effectively as an individual, and as a member

or leader in diverse teams, and in multidisciplinary settings.


PO10 Communication Skills: Communicate effectively on complex Engineering activities

with the Engineering community and with society, such as, being able to comprehend

and write effective reports and design documentation, make effective presentations,

and give and receive clear instructions.

PO11 Project Management and Finance: Demonstrate knowledge and understanding of

the Engineering and management principles and apply these to one’s own work, as a

member and leader in a team, to manage projects and in multidisciplinary

Environments.

PO12 Life-long Learning: Recognize the need for, and have the preparation and ability to

engage in independent and life-long learning in the broadest context of technological

change.
DESIGN AND ANALYSIS OF ALGORITHM LABORATORY

Course Code : 20AIL58A Credits: 2


L: T: P: : 0: 0: 2: 0: CIE 2
S: Marks: 5
Exam Hours: : 3 SEE 2
Marks: 5

Course Outcomes: At the end of the Course, the Student will be able to
CO# COURSE OUTCOME
20AIL58A. Analyze the complexities of various applications in different domains
1
20AIL58A. Implement efficient algorithms to solve problems in various domains
2
20AIL58A. Use suitable design technique to develop efficient algorithms
3
20AIL58A. Compare, implement and understand when to apply various design techniques
4

Mapping of Course Outcomes to Program Outcomes


P P P P P P P P P P P P P P
O O O O O O O O O O O O S S
1 2 3 4 5 6 7 8 9 10 11 12 O O
1 2
20AIL58 3 - - - - - - - - - - 3 3 2
A.1
20AIL58 - 3 3 3 - - - - - - - 3 3 2
A.2
20AIL58 - - - 3 3 - - - - - - 3 3 2
A.3
20AIL58 - - - 3 3 - - - - - - 3 3 2
A.4
Correlation levels: 1-Slight(Low)2-Moderate(Medium) 3-Substantial(High)

Exp. Experim Hour CO


No ent s
Write a program to find GCD of two numbers using differential CO1
1 4
Algorithms
2 Write a program to implement string matching using Brute force 4 CO1
Write a program to implement Merge Sort CO
3 4
2,
CO
3
Write a program to implement Quick Sort CO
4 4
2,
CO
3
Write a program to obtain minimum cost spanning tree using CO
5
Prim’s Algorithm 4 2,
CO
3
Write a program to obtain minimum cost spanning CO
6
tree using Kruskal’s Algorithm 4 2,
CO
3
Write a program to obtain shortest path using Djikstra’s CO
7 4
algorithm 2,
CO
3
Write a program to obtain shortest path using Floyds algorithms CO
8 4
2,
CO
3
Write a program to compute Transitive closure using Warshall’s CO
9
Algorithm 4 2,
CO
3
Write a program to implement Topological sorting CO
10 4
2,
CO
3
Write a program to implement Subset Sum problem CO4
11 4
using Backtracking
Write a program to implement N Queens problem using 4 CO4
12
Backtracking
Text Book:
1. Anany Levitin, “Introduction totheDesign & Analysis of Algorithms”, SECOND Edition
PEARSON Education

Reference Book:
1. Thomas H Cormen, Charles E Leiserson, Ronald R Rivest& Clifford Stein, “Introduction to
Algorithms”, THIRD Edition, Eastern Economy Edition

CIE- Continuous Internal Evaluation (25 Marks)

Bloom’s Category Review (25marks)


Remember -
Understand -
Apply 1
0
Analyze 1
0
Evaluate 5
Create -

SEE- Semester End Examination (25Marks)

Bloom’s Category Review (25marks)


Remember -
Understand -
Apply 1
0
Analyze 1
0
Evaluate 5
Create -
CONTENTS

Exp. List of
No Experiments
1 Write a program to find GCD of two numbers using different algorithms
2 Write a program to implement string matching using Brute force
3 Write a program to implement Merge Sort
4 Write a program to implement Quick Sort
5 Write a program to obtain minimum cost spanning tree using Prim’s Algorithm
6 Write a program to obtain minimum cost spanning tree using Kruskal’s Algorithm
7 Write a program to obtain shortest path using Djikstra’s algorithm
8 Write a program to obtain shortest path using Floyds algorithms
9 Write a program to compute Transitive closure using Warshall’s algorithm
10 Write a program to implement Topological sorting
11 Write a program to implement Subset Sum problem using Backtracking
12 Write a program to implement N Queens problem using Backtracking
LAB RUBRICS

Internal Assessment Marks: 25

Divided into two components:

1. Continuous Assessment: 10 marks


2. Internal Test: 15 marks

1. Continuous Assessment:
i) Will be carried out in every lab (for labs -10 programs)
ii) Each program will be evaluated for 10 marks
iii) Totally for 12 lab programs it will be 120 marks. This will be scaled down to 10.
iv) During the semester, 2 internal tests will be conducted for 25 marks each. The total 50 marks for
the internal tests, will be scaled down to 15.

Break up of 10 marks (in every lab):

Will be carried out in every lab (for 12 lab programs)

Attributes Descriptors Scores


Complete program with proper variable naming, proper
4
commenting
Complete program with not so proper variable
3
Program naming, poor commenting
Write-
Incomplete code 2
up(4)
Not written 1

Passes all specified test cases efficiently 3


Execution
Fails in some test cases 2
&
Results
Incomplete execution 1
(3)
Answers correctly & Submits in time 3
Viva Voce &
Record(3) Answers satisfactorily & Fails to submit the record in 2
time

Do not answer any question & incomplete submission 0


2. Internal Test:

Break up of 25 marks (for each of the 2 internal tests) which is scaled down to 15marks after the conduction of 2
internal tests:

The 1st lab internal will comprise of the first 6 lab programs and the 2nd lab internal will comprise of the next
6 lab programs.

Attributes Descriptors Scores


Complete program with proper variable naming, proper
5
commenting
Complete program with not so proper variable
3
Program naming, poor commenting
-
Write- 4
up(5)
Incomplete code 1
-
2
Not written 0

Passes all specified test cases efficiently 1


5
Execution
& Results Fails in some test cases 10-14
(15)
Incomplete execution 1
-
9
Answers 100% questions correctly 5

Answers 75% questions correctly 3


Viva Voce(5) -
4
Answers satisfactorily 1
-
2
Does not answer any question 0
SEE

Assessment Marks: 25

Session End Examination is conducted for 50 marks which is scaled down to 25 marks.

Attributes Descripto Scores


rs
Complete program with proper variable naming,
5
proper commenting
Complete program with not so proper variable
3
Program naming, poor commenting
-
Write- 4
up(5)
Incomplete code 1
-
2
Not written 0

Passes all specified test cases efficiently 1


5
Execution
& Results Fails in some test cases 10-14
(15)
Incomplete execution 1
-
9
Answers 100% questions correctly 5

Answers 75% questions correctly 3


Viva Voce(5) -
4
Answers satisfactorily 1
-
2
Does not answer any question 0
EXERCISE 1

1. Write a program to find GCD of two numbers using different


algorithms

Euclid’s Algorithm and Consecutive Integer Checking Algorithm


def gcde(m,n):
if m< n:
(m,n) = (n,m)
while n!=0:
r=m % n
m=n
n=r
return m

def gcdc(m,n):
t=min(m, n)
while t > 0:
if m % t == 0 and n % t == 0:
return t
t =t - 1

print("Program to find the GCD of 2 numbers using:")


print("1: Euclid's Algorithm")
m = int(input("enter first number: "))
n = int(input("enter second number: "))
print(gcde(m,n))
print("2: Consecutive Integer Checking Algorithm")
m = int(input("enter first number: "))
n = int(input("enter second number: "))
print(gcdc(m,n)
OUTPUT

1:Euclid’s Algorithm

Enter first number:60

Enter second number:12

24

2: Consecutive Integer Checking


Algorithm

Enter first number:60

Enter second number:12

24
EXERCISE 2

2. Write a program to implement string matching using Brute force

def string_match(a,b):
a=" "+a+" "
b=" "+b+" "
n=len(a)
m=len(b)
count=0
for i in range(n-m+1):
if a[i:i+m]==b:
print("pattern found at",i+1)
count=count+1
if count==0:
print("pattern not found")

x=input("enter main string:")


y=input("enter search string:")
string_match(x,y)

OUTPUT

Enter the text: She sells sea shells

Enter the pattern:sells

5
EXERCISE 3

3. Write a program to implement Merge Sort

def merge(arr, l, m, r):


n1 = m - l + 1
n2 = r- m
L = [0] * (n1)
R = [0] * (n2)

for i in range(0,n1):
L[i] = arr[l + i]
for j in range(0 , n2):
R[j] = arr[m + 1+j]
i=0
j=0
k=l

while i < n1 and j <n2:


if L[i] <= R[j]:
arr[k] =L[i]
i += 1
else:
arr[k]=R[j]
j += 1
k += 1
while i < n1:
arr[k]=L[i]
i += 1
k += 1
while j < n2:
arr[k]=R[j]
j += 1
k += 1
def
mergeSort(arr,l,r)
if l < r:
m = (l+(r-1))//2
mergeSort(arr, l, m)
mergeSort(arr, m+1, r)
merge(arr, l, m, r)

arr = [12, 11, 13, 5, 6, 7]


n = len(arr)
print ("Given arrayis")
for i in range(n):
print ("%d"
%arr[i])
mergeSort(arr,0,n-1)
print ("\n\nSorted array
is") for i in range(n):
print ("%d" %arr[i])

OUTPUT

Given array is 12 11 13 5 6 7

Sorted array is
5
6
7
11
12
13
EXERCISE 4

4. Write a program to implement Quick Sort


n = int(input("How many elements do you want to add? "))
Array = []
print("Enter the elements of the list: ")
for i in range(n):
Array.append(input())
print ('The entered elements are',Array)

low = 0
up = len(Array) - 1
def partition(Array,low,up):
i = low+1
j = up
pivot = Array[low]
while(i<=j):
while(Array[i]<=pivot and i<up): // move I to right until element of i>pivot
i = i+1
while(Array[j]>pivot): //move j to left until element of j is lesser than pivot
j = j-1

if(i<j): //I and j stopped moving so swap I and j


Array[i],Array[j] = Array[j],Array[i]
i = i+1
j = j-1

else: // I and j crossed so swap pivot and j


i = i+1
Array[low] = Array[j]
Array[j] = pivot
return j

def quick(Array,low,up):
if(low>=up):
return
piv_loc = partition(Array,low,up)
quick(Array,low,piv_loc-1)
quick(Array,piv_loc+1,up)
quick(Array,low,up)
print('Sorted elements are:')
for i in Array:
print (i);

OUTPUT

How many elements do you want to add? 5


Enter the elements of the list:
65
43
23
0
10
The entered elements are ['65', '43', '23', '0', '10']
Sorted elements are:
0
10
23
43
65
EXERCISE 5

5. Write a program to obtain minimum cost spanning tree using Prim’s Algorithm

INF = 9999999
# number of vertices in graph
N=5
#creating graph by adjacency matrix method
G = [[0, 19, 5, 0, 0],
[19, 0, 5, 9, 2],
[5, 5, 0, 1, 6],
[0, 9, 1, 0, 1],
[0, 2, 6, 1, 0]]

selected_node = [0, 0, 0, 0, 0]

no_edge = 0

selected_node[0] = True

# printing for edge and weight


print("Edge : Weight\n")
while (no_edge < N - 1):

minimum = INF
a=0
b=0
for m in range(N):
if selected_node[m]:
for n in range(N):
if ((not selected_node[n]) and G[m][n]):
# not in selected and there is an edge
if minimum > G[m][n]:
minimum = G[m][n]
a=m
b=n
print(str(a) + "-" + str(b) + ":" + str(G[a][b]))
selected_node[b] = True
no_edge += 1

OUTPUT

Edge : Weight

0-2:5
2-3:1
3-4:1
4-1:2
EXERCISE 6

6. Write a program to obtain minimum cost spanning tree using Kruskal’s Algorithm

class Graph:
def __init__(self, vertex):
self.V = vertex
self.graph = []

def add_edge(self, u, v, w):


self.graph.append([u, v, w])

def search(self, parent, i):


if parent[i] == i:
return i
return self.search(parent, parent[i])

def apply_union(self, parent, rank, x, y):


xroot = self.search(parent, x)
yroot = self.search(parent, y)
if rank[xroot] < rank[yroot]:
parent[xroot] = yroot
elif rank[xroot] > rank[yroot]:
parent[yroot] = xroot
else:
parent[yroot] = xroot
rank[xroot] += 1

def kruskal(self):
result = []
i, e = 0, 0
self.graph = sorted(self.graph, key=lambda item: item[2])
parent = []
rank = []
for node in range(self.V):
parent.append(node)
rank.append(0)
while e < self.V - 1:
u, v, w = self.graph[i]
i=i+1
x = self.search(parent, u)
y = self.search(parent, v)
if x != y:
e=e+1
result.append([u, v, w])
self.apply_union(parent, rank, x, y)
for u, v, weight in result:
print("Edge:",u, v,end =" ")
print("-",weight)

g = Graph(5)
g.add_edge(0, 1, 4)
g.add_edge(0, 2, 4)
g.add_edge(1, 2, 2)
g.add_edge(1, 0, 4)
g.add_edge(2, 0, 4)
g.add_edge(2, 1, 2)
g.add_edge(2, 3, 3)
g.add_edge(2, 5, 2)
g.add_edge(2, 4, 4)
g.add_edge(3, 2, 3)
g.add_edge(3, 4, 3)
g.add_edge(4, 2, 4)
g.add_edge(4, 3, 3)
g.add_edge(5, 2, 2)
g.add_edge(5, 4, 3)
g.kruskal()
self.graph = sorted(self.graph, key=lambda item: item[2]
for node in range(self.V):

34 parent.append(node)

35 rank.append(0)

while e < self.V - 1:


u, v, w = self.graph[i]
x = self.search(parent, u)
Edge 0----------------->1
Edge 1-----------------3
Both has different parents , so can be connected.
Rank of 3 is lower , so 3 will point to 1.so parent(3) will be
1.

Edge 2-----------------4
Parent(2)=2,parent(4)=4.So edge can be formed.
Rank of 2 and 4 are 0.
Now, let us point 2 to 4 2----🡪4
So, now parent(2)=4.
And new absolute parent will have one rank higher,So
update rank(4)=1
Edge 0-----------------2
Parent(0)=1,parent(2)=4. So edge can be formed.
Rank(0) =rank(1)=1
Rank(2)=Rank(4)=1
Both have same rank , so point 1 to 4 .Now parent(1) =4,
update rank(4)to 2

Edge 2-----------------3
Parent(2)=4 Parent(3)=parent(1)=4.. So same parent cannot form

Try for edge Edge 4-----------------5

OUTPUT

Edge: 0 2 - 5
Edge: 3 4 - 7
Edge: 0 1 - 8
Edge: 2 4 - 10
EXERCISE 7

7. Write a program to obtain shortest path using Djikstra’s algorithm


import sys
class Graph():
def __init (self, vertices):
self.V = vertices
self.graph = [[0 for column in
range(vertices)] for row in
range(vertices)]

def printSolution(self, dist):


print("Vertex tDistance from
Source") for node in range(self.V):
print(node, "t", dist[node])

def minDistance(self, dist,


sptSet): min = sys.maxsize
for v in range(self.V):
if dist[v] < min and sptSet[v] ==
False: min = dist[v]
min_index = v
return min_index

def dijkstra(self, src):


dist = [sys.maxsize] * self.V
dist[src] = 0
sptSet = [False] * self.V
for cout in
range(self.V):
u = self.minDistance(dist, sptSet)
sptSet[u] = True
for v in range(self.V):
if self.graph[u][v] > 0 and
sptSet[v] == False and
dist[v] > dist[u] + self.graph[u][v]:
dist[v] = dist[u] + self.graph[u][v]
self.printSolution(dist)
g = Graph(9)
g.graph = [[0, 4, 0, 0, 0, 0, 0, 8, 0],
[4, 0, 8, 0, 0, 0, 0, 11, 0],
[0, 8, 0, 7, 0, 4, 0, 0, 2],
[0, 0, 7, 0, 9, 14, 0, 0, 0],
[0, 0, 0, 9, 0, 10, 0, 0, 0],
[0, 0, 4, 14, 10, 0, 2, 0, 0],
[0, 0, 0, 0, 0, 2, 0, 1, 6],
[8, 11, 0, 0, 0, 0, 1, 0, 7],
[0, 0, 2, 0, 0, 0, 6, 7, 0]
]

g.dijkstra(0)

OUTPUT

Vertex Distance from Source


0 0
1 4
2 12
3 19
4 21
5 11
6 9
7 8
8 14
EXERCISE 8
8. Write a program to obtain shortest path using Floyds algorithms
nV = 4
INF = 999

def floyd(G):
dist = list(map(lambda p: list(map(lambda q: q, p)), G))

for r in range(nV):
for p in range(nV):
for q in range(nV):
dist[p][q] = min(dist[p][q], dist[p][r] + dist[r][q])
sol(dist)

def sol(dist):
for p in range(nV):
for q in range(nV):
if(dist[p][q] == INF):
print("INF", end=" ")
else:
print(dist[p][q], end=" ")
print(" ")

G = [[0, 5, INF, INF],


[50, 0, 15, 5],
[30, INF, 0, 15],
[15, INF, 5, 0]]
floyd(G)
OUTPUT

0 5 15 10
20 0 10 5
30 35 0 15
15 20 5 0
EXERCISE 9

9. Write a program to compute Transitive closure using Warshall’s algorithm


from collections import defaultdict
class Graph:
def init (self, vertices):
self.V = vertices

def printSolution(self, reach):


print ("Following matrix transitive closure of the given
graph ") for i in range(self.V):
for j in
range(self.V): if
(i == j):
print ("%7d\t" %
(1)) else:
print ("%7d\t" %(reach[i]
[j])) print ("")

def transitiveClosure(self,graph):
reach =[i[:] for i in graph]
for k in range(self.V):
for i in
range(self.V):
for j in range(self.V):
reach[i][j] = reach[i][j] or (reach[i][k] and reach[k]
[j]) self.printSolution(reach)
g= Graph(4)
graph = [[1, 1, 0, 1],
[0, 1, 1, 0],
[0, 0, 1, 1],
[0, 0, 0, 1]]
g.transitiveClosure(graph)

OUTPUT
Following matrix transitive closure of the given graph
1 1 1 1
0 1 1 1
0 0 1 1
0 0 0 1
EXERCISE 10
10. Write a program to implement Topological sorting
from collections import defaultdict
class Graph:
def __init (self,vertices):
self.graph = defaultdict(list) #dictionary containing adjacency
List self.V = vertices #No. of vertices

def addEdge(self,u,v):
self.graph[u].append(v)
def topologicalSortUtil(self,v,visited,stack):
visited[v] = True
for i in self.graph[v]:
if visited[i] == False:
self.topologicalSortUtil(i,visited,stack)
stack.insert(0,v)

def topologicalSort(self):
visited = [False]*self.V
stack =[]
for i in range(self.V):
if visited[i] == False:
self.topologicalSortUtil(i,visited,stack)
print stack

g= Graph(6)
g.addEdge(5, 2);
g.addEdge(5, 0);
g.addEdge(4, 0);
g.addEdge(4, 1);
g.addEdge(2, 3);
g.addEdge(3, 1);
print "Following is a Topological Sort of the given
graph" g.topologicalSort()
OUTPUT
Following is a Topological Sort of the given graph
[5, 4, 2, 3, 1, 0]
EXERCISE 11

11. Write a program to implement Subset Sum problem using Backtracking


def isSubsetSum(set, n, sum) :
if (sum == 0) :
return True
if (n == 0 and sum !=
0) : return False

if (set[n - 1] > sum) :


return isSubsetSum(set, n - 1, sum);

return isSubsetSum(set, n-1, sum) or isSubsetSum(set, n-1, sum-set[n-1])

set = [3, 34, 4, 12, 5, 2]


sum = 9
n = len(set)
if (isSubsetSum(set, n, sum) == True) :
print("Found a subset with given sum")
else :
print("No subset with given sum")

OUTPUT

Found a subset with given sum


EXERCISE 12

12. Write a program to implement N Queens problem using Backtracking


OUTPUT
4

- -Q–
Q - - -
- --Q
- Q--

- Q--
- --Q
Q-- -
- Q--
VIVA QUESTIONS

1.Define Algorithm
2.What are the steps in fundamentals of Algorithmic problem solving
3.Define Searching
4.What are the examples of searching
5.Which is best merge sort or quick sort?
6.What is the time complexity of Merge sort?
7.What is the worst-case time complexity of Quick sort?
8. What is the best-case time complexity of Strassen’s matrix multiplication?
9.Specify the advantages and disadvantages of divide and conquer?
10.What are the criteria for constructing minimum spanning tree?
11.Which is best method for constructing MST?
12. Define dynamic programming?
13. What is the time complexity of Dijkstra’s algorithm
14.Explain transitive closure property of Warshall’s algorithm?
15.Difference between BFS and DFS
16.Difference between AVL trees and binary search trees
17.In how many ways a queen can be attacked in 4-queens problem
18.Define Travelling Salesman problem
19.Which method is used to solve subset sum problem?
20.Difference between decrease and conquer and divide and conquer?

You might also like