fault Paragraph Styl A A Liberation Serif 7 pt BIU S A A LA-AO - 10 11 12 13 Winclude Winclude 0 && y= WIDTH| y >= HEIGHT|| Imaze[yx]) { %3D return; if (x dest x && y= dest y) std:cout << path std::cout <
fault Paragraph Styl A A Liberation Serif 7 pt BIU S A A LA-AO - 10 11 12 13 Winclude Winclude 0 && y= WIDTH| y >= HEIGHT|| Imaze[yx]) { %3D return; if (x dest x && y= dest y) std:cout << path std::cout <
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
how can this code display only for these paths, what needs to be changed c++
![Window
Help
T ー国▼
Default Paragraph Styl
Liberation Serif
7 pt
BIU S
A A, LA
7
8.
6.
10
11
12
13
14
15
#include <iostream>
#include <string>
using namespace std;
const int WIDTH = 5;
const int HEIGHT = 5;
int x_cor[] = {, 0, 1, -1};
int y_cor[] = {1, -1, 0, 0};
bool checkCoordinates(int x, int y)
{
return (x >= 0 && x < HEIGHT && y >= 0 && y<WIDTH);
17
void check(int x, int y, int dest_x, int dest_y,
int (&maze)[HEIGHT][WIDTH], std::string &path, int (&visited)[HEIGHT|[WIDTH])
// if (x<0 || y < 0 || x >= WIDTH| y >= HEIGHT || !maze[y][x]) {
return;
// }
if (x == dest_x &&y == dest _y)
{
std::cout << path;
std::cout << x <<","<<y<< \n';
return;
vi sited[x][y] = 1;
int len = path.size();
path += (char)('O' + x);
path +=',;
path += (char)('0" + y);
path += " > ".
for (int k = 0; k < 4; k++)
int newi = x + x_cor[k];|
、田
O AT
File Edit
View
Insert
Format Styles Table
Form
Tools Window Help
開,
Default Paragraph Styl
A Liberation Serif
7 pt
BIU
A A, L A
2
10
12
int newi = x+ x_cor[k];
int newj = y + y_cor[k];
if (checkCoordinates(newi, newj) && maze[newi][newj] == 1 && visited[newi][newj] ==0)
11
13
14
16
check(newi, newj, dest_x, dest_ y, maze, path, visited);
visited[newi][newj] = 0;
path.resize(len);
int main()
int maze[HEIGHT][WIDTH] = {
{1, 1, 1, 1, 1},
{1, 1, 1, 0, 1},
{0, 1, 1, 0, 1},
{0, 1, 0,0, 1},
{0, 1, 1, 1, 1}};
int visited[HEIGHT][WIDTH];
for (int i = 0; i<HEIGHT; i++)
for (int j = 0; j <WIDTH; j++)
vi sited[i][j] = 0;
std:string path;
check(0, 0, 4, 4, maze, path, visited);
return 0,](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ffa465a4c-2f75-4e29-9be3-0ddfd3398771%2Fcc9bec81-b2ac-4fe7-aee8-6a7d957ed34f%2F8443wta_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Window
Help
T ー国▼
Default Paragraph Styl
Liberation Serif
7 pt
BIU S
A A, LA
7
8.
6.
10
11
12
13
14
15
#include <iostream>
#include <string>
using namespace std;
const int WIDTH = 5;
const int HEIGHT = 5;
int x_cor[] = {, 0, 1, -1};
int y_cor[] = {1, -1, 0, 0};
bool checkCoordinates(int x, int y)
{
return (x >= 0 && x < HEIGHT && y >= 0 && y<WIDTH);
17
void check(int x, int y, int dest_x, int dest_y,
int (&maze)[HEIGHT][WIDTH], std::string &path, int (&visited)[HEIGHT|[WIDTH])
// if (x<0 || y < 0 || x >= WIDTH| y >= HEIGHT || !maze[y][x]) {
return;
// }
if (x == dest_x &&y == dest _y)
{
std::cout << path;
std::cout << x <<","<<y<< \n';
return;
vi sited[x][y] = 1;
int len = path.size();
path += (char)('O' + x);
path +=',;
path += (char)('0" + y);
path += " > ".
for (int k = 0; k < 4; k++)
int newi = x + x_cor[k];|
、田
O AT
File Edit
View
Insert
Format Styles Table
Form
Tools Window Help
開,
Default Paragraph Styl
A Liberation Serif
7 pt
BIU
A A, L A
2
10
12
int newi = x+ x_cor[k];
int newj = y + y_cor[k];
if (checkCoordinates(newi, newj) && maze[newi][newj] == 1 && visited[newi][newj] ==0)
11
13
14
16
check(newi, newj, dest_x, dest_ y, maze, path, visited);
visited[newi][newj] = 0;
path.resize(len);
int main()
int maze[HEIGHT][WIDTH] = {
{1, 1, 1, 1, 1},
{1, 1, 1, 0, 1},
{0, 1, 1, 0, 1},
{0, 1, 0,0, 1},
{0, 1, 1, 1, 1}};
int visited[HEIGHT][WIDTH];
for (int i = 0; i<HEIGHT; i++)
for (int j = 0; j <WIDTH; j++)
vi sited[i][j] = 0;
std:string path;
check(0, 0, 4, 4, maze, path, visited);
return 0,
![1, 1, 1, 1, 1 },
1, 1,, 0, 1 },
8, 1, 8, 1 },
0, 1, 0, e, 1 },
},
1, 1, 1, 0,
1, 1,
1, 1, 1, 1 },
1, а, 1 },
0,
1, 1, 1, 1 },
, 1, 0, 1 },
1, в, 1 },
0, , в, а, 1 },
в, 1. 1, 1, 1 }
},
в, 1, 1, в,
1, 1:
},
в, 1, 8, в,
в, 1, 1, 1, 1}
1, в, 1 },
в, в, 1 },
0,
1, 1, 1, 1 },
1, 1, 1, е, 1 },
0, 5
в, в, 1 },
0,
,8, 1 },](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ffa465a4c-2f75-4e29-9be3-0ddfd3398771%2Fcc9bec81-b2ac-4fe7-aee8-6a7d957ed34f%2Frp8x11s_processed.jpeg&w=3840&q=75)
Transcribed Image Text:1, 1, 1, 1, 1 },
1, 1,, 0, 1 },
8, 1, 8, 1 },
0, 1, 0, e, 1 },
},
1, 1, 1, 0,
1, 1,
1, 1, 1, 1 },
1, а, 1 },
0,
1, 1, 1, 1 },
, 1, 0, 1 },
1, в, 1 },
0, , в, а, 1 },
в, 1. 1, 1, 1 }
},
в, 1, 1, в,
1, 1:
},
в, 1, 8, в,
в, 1, 1, 1, 1}
1, в, 1 },
в, в, 1 },
0,
1, 1, 1, 1 },
1, 1, 1, е, 1 },
0, 5
в, в, 1 },
0,
,8, 1 },
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY