Midterm Review Flashcards
Which attributes are typically stored on the nodes of a search tree for uninformed search?
the state of the node
link to the parent node
the last action taken before moving to this state
the depth of the node
the path cost from the root to the current node
What additional information would you need to store for informed search than for uninformed search?
cost of the path to the goal node
What is the difference between tree-search and graph-search?
Tree search allows for repeated states, and graph search doesn’t
Graph search uses a closed list to keep track of explored nodes
What type of search do we use when we are searching for a path on a grid?
Graph search
Allowing repeated states makes it impossible to search a grid. Every time you would expand a child node, it would bring up the parent node, allowing you to explore it again. The parent node would then expand on the child node again and the process repeats because there is no limit.
What is dynamic programming?
algorithmic technique for solving an optimization problem by breaking it down into simpler subproblems and using the fact that the optimal solution depends on the optimal solutions to its subproblems
What type of search do we use when searching for a solution to the 8-queens problem?
Tree search
You want to list all possible queens that can be placed in a row. If you limit yourself based on the queens that have been looked at before, you make it difficult, or nearly impossible, to find a solution because you are excluding possible placements of queens.
https://www.codeproject.com/Articles/806248/Eight-Queens-Puzzle-Tree-Algorithm
Which type of search do we use when we are searching for a path between cities on a road network? Why?
Graph search
You don’t want to visit a city more than once when traveling between cities. It would make the path unnecessarily long
What are the criteria used to compare search algorithms?
Time and space complexity, completeness, and optimality
What are the properties for BFS? Completeness, optimality, time and space complexity
Complete: if there is a finite number of nodes
optimal: Yes, finds shortest path to goal node
Time complexity: O(b^d), b = branching factor, d = depth of shallowest solution
Space complexity: O(b^d), b = branching factor, d = depth of shallowest solution
What are the properties for DFS? Completeness, optimality, time and space complexity
Complete: if there is a finite number of nodes
optimal: No, could return the longest path and there is a shorter one out there
Time complexity: O(b^m), b = branching factor, m = max depth of tree
Space complexity: O(bm), b = branching factor, m = depth of shallowest solution
What are the properties for Iterative-deepening depth first search? Completeness, optimality, time and space complexity
Complete: yes
optimal: Yes, if all edges have the same cost
Time complexity: O(b^d), b = branching factor, d = depth of shallowest goal node
Space complexity: O(bm), b = branching factor, m = depth of tree
What are the properties for uniform cost search? Completeness, optimality, time and space complexity
Complete: yes
optimal: yes
Time complexity: O(b^([C/ε] + 1)), b = branching factor, d = max depth of tree
Space complexity: O(b^([C/ε]+1)), b = branching factor, d = depth of shallowest solution
What are the properties for bidirectional search? Completeness, optimality, time and space complexity
Complete: yes
optimal: Yes, if the edges have the same cost
Time complexity: O(b^(d/2)), b = branching factor, d = depth of shallowest solution
Space complexity: O(b^(d/2)), b = branching factor, d = depth of shallowest solution
Which uninformed search technique has the best time and space complexity? What is the time and space complexity?
Best time complexity: bfs
Best space: dfs, iterative
Best both: iterative
Which algorithm would you use if you knew that the depth of the search tree is bounded and why?
Iterative deepening
Better state space than bfs
Prove that uniform-cost search and breadth-first search with constant edge costs are optimal when used in GRAPH-SEARCH.
https://www.geeksforgeeks.org/breadth-first-search-is-a-special-case-of-uniform-cost-search/
Show a state space with varying step costs in which a GRAPH-SEARCH approach that uses depth-first (or iterative-deepening depth first) finds a suboptimal solution.
tbd
Under which circumstances can you apply bidirectional search?
When the start and goal state are known
When you can inverse the problem, which can be hard, especially if you have a bunch of different goal states (e.g. chess)
You need an additional data structure in order to be able to solve GRAPH-SEARCH problems. How is this data structure called and how can you implement it?
A closed list (e.g. hash table)
True/False and Why: Iterative deepening search is preferred over breadth-first search.
True
Has space complexity and completeness of DFS
True/False and Why: Bidirectional search is preferred over breadth-first search.
False
Only preferred in really specific situations
might be ideal in situations where the goal state is known and it’s easy to inverse the problem
What is the name of the overall search strategy that selects the fringe node which maximizes an evaluation function ƒ (n)? Name two approaches that implement this search strategy? How do they define the evaluation function? What does a heuristic represent?
Best-first search
Two approaches:
A*: f(n) = g(n) + h(n), where
f(n) = overall value/cost of node
g(n) = true cost of the path from the root node to the current node
h(n): heuristic value of node
Greedy best-first search: f(n) = h(n)
h(n): heuristic value of node; estimated cost from current to goal
What are the properties of greedy best-first search? How does it work?
Complete? No, no guarantee that you won’t go down an infinite path
Time complexity: O(b^m) where m = max depth of tree
Space complexity: O(b^m) - algorithm may have to remember all of the leaf nodes at level m
Optimal? No, not even complete
What are the properties of A* in TREE-SEARCH? How does it work?
Repeated states are allowed
For A* to be optimal, must use an admissible (optimistic) heuristic
h(n) <= C*(n) for all n
Works like regular A*, just allows for repeated states (using a tree to explore paths)