Question
1. (5 pts) A cycle is a path that starts and ends at the same vertex, and that includes at least one edge. Your task
1. (5 pts) A cycle is a path that starts and ends at the same vertex, and that includes at least one edge. Your task is to design an algorithm to determine if a graph contains any cycle.
2. (5 pts) A graph is connected if , for any two vertices, there is a path between them. Your task is to design an algorithm to determine if a graph is connected.
Extra Credit (5 pts)
Say that a maze is constructed correctly if there is one path from the start to the finish, the entire maze is reachable from the start, and there are no loops around any portion of the maze. Given a maze drawn n X n grid, design an algorithm to determine if the maze is constructed correctly. Your algorithm should run in O(n) times.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started