Professional Documents
Culture Documents
Daa Mini Project
Daa Mini Project
PROJECT
REPORT
ON
SHORTEST SAFE ROUTE IN A PATH
FULL OF LANDMINES USING
BACKTRACKING
Submitted in partial fulfilment of the requirement tot the IV semester
of
BACHELOR OF
TECHNOLOGY
Submitted By:
(Asst. Professor)
2022
DECLARATION
Approved By:
Dr. P.C. Karthik
I would like to thank Dr. P.C. Karthik(Asst. Professor) who has
been a great inspiration and who have provided sufficient
background knowledge and understanding of this subject.
Our humble prostration goes to her, for providing all the
necessary resources and environment, which have aided me to
complete this project successfully.
CONTRIBUTION TABLE
NAME CONTRIBUTION
Harshit Batra (RA2011026010206) Developing algorithm, prepared and
presented the ppt
Saahir Khan (RA2011026010218) Developing the algorithm, prepared the
report
Aman Kumar (RA2011026010226) Developing the algorithm, analysis of the
algorithm, ideated the application of
algorithm
PR0 B L E M S A TE E T
PR O B E M E X P L A A T I O W I TH D I A G R A M
T I M E C O MP L E X ITY
REFERE CES
Shortest safe route in a path with landmines
Problem Statement:
Imagine a case in which we are given a path in the form of a rectangular
matrix having few landmines arbitrarily placed , calculate length of the
shortest safe route possible from any cell in the first column to any cell in
the last column of the matrix. We have to avoid landmines and their four
adjacent cells (left, right, above and below) . We are allowed to move to
only adjacent cells which are not landmines. i.e. the route cannot contains
any diagonal moves.
Problem Explanation with Diagram and Example
Consider the field of size 4*4, shown below. The cells containing landmine
are marked with 0 and red colour. The cells near the landmine which are
unsafe are marked with a light red colour.
The shortest safe route for person, starting from any cell in the first column
to any cell in the last column of the field is marked with green colour. The
length of the path is 3.
Algorithm Used
BACKTRACKING ALGORITHM
#include <bits/stdc++.h>
using namespace std;
#define R 12
#define C 10
return true;
}
// Backtrack visited[i]
[j] = 0;
}
// Driver code
int main()
{
// input matrix with landmines shown with number 0
int mat[R][C] =
{
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 },
{ 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 1, 1, 1, 1, 0, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }
};
// find shortest path
findShortestPath(mat);
return 0;
}
Input-
O/P-
Length of shortest safe route is 13
Time complexity:
Conclusion: