GOOD PROBLEM
Analysis
- Breadth first search is used
- when the end word is reached, the search finished and return the current search depth
- if the search queue has been empty and end word is till not reached, return 0 denote no transformation sequence
- erase the node from dict once it is reached because it is no more useful in the bfs
Note
- using a queue to implement the BFS
- implementation of bi-direction BFS
- implementation BFS how to erase the searching nodes while doing searching( queue.erase(iterator++)
- implementation BFS only needs to store two search level current and next which searches iteratively
Code
UPDATED AT LEETCODE 2ND PASS
No comments:
Post a Comment
Enter you comment